From 249758f658c5bb72af9883e18a3bbd70622a8465 Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Thu, 1 Jun 2017 15:24:45 +0200 Subject: [PATCH 01/35] Update yajl-ruby to 1.3.0 1.2.0 does not compile anymore on tumbleweed... --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 90ae82f0..4f002b4a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -538,7 +538,7 @@ GEM chronic (>= 0.6.3) xpath (2.0.0) nokogiri (~> 1.3) - yajl-ruby (1.2.0) + yajl-ruby (1.3.0) PLATFORMS ruby From 54609cabcf67e8074157f0e3b2b15b8c1d4cf6e1 Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Thu, 1 Jun 2017 15:39:45 +0200 Subject: [PATCH 02/35] Prepare settings for new deployment --- config/deploy.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/deploy.rb b/config/deploy.rb index 5a9090fb..9b76c176 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -3,7 +3,7 @@ require 'mina/rails' require 'mina/git' set :domain, 'proxy-opensuse.suse.de' -set :port, 2214 +set :port, 2252 set :user, 'osem' set :deploy_to, '/srv/www/vhosts/opensuse.org/events' set :repository, 'https://github.com/openSUSE/osem.git' @@ -42,7 +42,7 @@ task deploy: :environment do #invoke :notify_errbit to :launch do - queue "sudo /etc/init.d/apache2 restart" + queue "sudo /usr/bin/systemctl restart apache2" queue "cd #{deploy_to}/current && RAILS_ENV=production bin/delayed_job start" end From 5a2c87630c1b107cf0174f772f2e75d3411687f8 Mon Sep 17 00:00:00 2001 From: Tobias Brunner Date: Mon, 28 Aug 2017 20:02:55 +0200 Subject: [PATCH 03/35] adapt dir permissions for openshift and add dumb-init This commit updates directory permissions to be compatible with OpenShift which starts the container with an arbitrary uid which is member of the root group. For more information please consult https://docs.openshift.org/latest/creating_images/guidelines.html. dumb-init is added to have a proper PID 1. bash should not run as PID 1 as this could lead to improper container shutdown. --- Dockerfile | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index dab432ca..4cc5c04c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,6 +16,12 @@ RUN cd /usr/bin && \ tar -xf dockerize.tar.gz && \ rm dockerize.tar.gz +# dumb-init for a proper PID 1 +RUN cd /tmp && \ + wget https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \ + dpkg -i dumb-init_1.2.0_amd64.deb && \ + rm dumb-init_1.2.0_amd64.deb + # explicitly add Gemfile and install dependencies using bundler to make use of # Docker's caching WORKDIR /osem/ @@ -25,12 +31,13 @@ RUN bundle install --without test development # add OSEM files and prepare them for use inside a Docker container COPY . /osem/ -RUN chown osem.osem /osem/ -R && \ +RUN chown -R osem.root /osem/ && \ + chmod -R g=u /osem/ && \ mv /osem/config/database.yml.docker /osem/config/database.yml # data directory is used to cache the secret key in a file ENV DATA_DIR /data -RUN install -d -m 0700 -o osem $DATA_DIR +RUN install -d -m 0770 -o osem -g root $DATA_DIR VOLUME ["$DATA_DIR"] USER osem @@ -42,4 +49,7 @@ COPY docker/init.sh /init.sh # from a webserver ENV RAILS_SERVE_STATIC_FILES 1 +# Runs "/usr/bin/dumb-init -- /my/script --with --args" +ENTRYPOINT ["/usr/bin/dumb-init", "--"] + CMD ["bash", "/init.sh"] From 3f3cdef52002884d005ab5749dd1be5e48754f6a Mon Sep 17 00:00:00 2001 From: rahul Date: Mon, 25 Sep 2017 00:34:53 +0530 Subject: [PATCH 04/35] Fix decimal limit of total to 2 Decimal limit is fixed to 2 as earlier at some values the decimal limit were crossing this limit --- app/assets/javascripts/osem-tickets.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/osem-tickets.js b/app/assets/javascripts/osem-tickets.js index 51881055..3f559c38 100644 --- a/app/assets/javascripts/osem-tickets.js +++ b/app/assets/javascripts/osem-tickets.js @@ -11,7 +11,7 @@ function update_price($this){ $('.total_row').each(function( index ) { total += parseFloat($(this).text()); }); - $('#total_price').text(total); + $('#total_price').text(total.toFixed(2)); } $( document ).ready(function() { From b761e83b45e51e34f5b676504863fe3db04fc5b2 Mon Sep 17 00:00:00 2001 From: rahul Date: Mon, 25 Sep 2017 00:38:20 +0530 Subject: [PATCH 05/35] Add amount paid Amount paid colum is added to ticket purchase to keep the record of money paid by the user. It is added to physical_ticket#index to show admin, price paid by each user for each ticket. --- app/models/ticket_purchase.rb | 3 ++- .../_physical_ticket.html.haml | 16 ++++++++++++++++ .../admin/physical_tickets/index.html.haml | 18 +++--------------- ...0528_add_amount_paid_to_ticket_purchases.rb | 5 +++++ db/schema.rb | 3 ++- 5 files changed, 28 insertions(+), 17 deletions(-) create mode 100644 app/views/admin/physical_tickets/_physical_ticket.html.haml create mode 100644 db/migrate/20170924190528_add_amount_paid_to_ticket_purchases.rb diff --git a/app/models/ticket_purchase.rb b/app/models/ticket_purchase.rb index 97fa9957..71b44d18 100644 --- a/app/models/ticket_purchase.rb +++ b/app/models/ticket_purchase.rb @@ -52,7 +52,8 @@ class TicketPurchase < ActiveRecord::Base purchase = new(ticket_id: ticket.id, conference_id: conference.id, user_id: user.id, - quantity: quantity) + quantity: quantity, + amount_paid: ticket.price) purchase.pay(nil) if ticket.price_cents.zero? end purchase diff --git a/app/views/admin/physical_tickets/_physical_ticket.html.haml b/app/views/admin/physical_tickets/_physical_ticket.html.haml new file mode 100644 index 00000000..ff4dd185 --- /dev/null +++ b/app/views/admin/physical_tickets/_physical_ticket.html.haml @@ -0,0 +1,16 @@ +%tr + %td= physical_ticket.id + %td= physical_ticket.ticket.title + %td= physical_ticket.user.email + %td= humanized_money_with_symbol physical_ticket.ticket_purchase.amount_paid + %td + .btn-group + = link_to 'Show', + conference_physical_ticket_path(conference.short_title, + physical_ticket.token), + class: 'btn btn-primary' + = link_to 'Generate PDF', + conference_physical_ticket_path(conference.short_title, + physical_ticket.token, + format: :pdf), + class: 'button btn btn-default btn-info' diff --git a/app/views/admin/physical_tickets/index.html.haml b/app/views/admin/physical_tickets/index.html.haml index 96c5911f..8b26a965 100644 --- a/app/views/admin/physical_tickets/index.html.haml +++ b/app/views/admin/physical_tickets/index.html.haml @@ -21,23 +21,11 @@ %th ID %th Type %th User + %th Paid %th Actions %tbody - @physical_tickets.each do |physical_ticket| - %tr - %td= physical_ticket.id - %td= physical_ticket.ticket.title - %td= physical_ticket.user.email - %td - .btn-group - = link_to 'Show', - conference_physical_ticket_path(@conference.short_title, - physical_ticket.token), - class: 'btn btn-primary' - = link_to 'Generate PDF', - conference_physical_ticket_path(@conference.short_title, - physical_ticket.token, - format: :pdf), - class: 'button btn btn-default btn-info' + = render "physical_ticket", physical_ticket: physical_ticket, + conference: @conference - else %h5 No Tickets sold! diff --git a/db/migrate/20170924190528_add_amount_paid_to_ticket_purchases.rb b/db/migrate/20170924190528_add_amount_paid_to_ticket_purchases.rb new file mode 100644 index 00000000..5e732d4c --- /dev/null +++ b/db/migrate/20170924190528_add_amount_paid_to_ticket_purchases.rb @@ -0,0 +1,5 @@ +class AddAmountPaidToTicketPurchases < ActiveRecord::Migration + def change + add_column :ticket_purchases, :amount_paid, :float, default: 0 + end +end diff --git a/db/schema.rb b/db/schema.rb index 82f5923d..6c6531c1 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20170816203325) do +ActiveRecord::Schema.define(version: 20170924190528) do create_table "ahoy_events", force: :cascade do |t| t.uuid "visit_id", limit: 16 @@ -504,6 +504,7 @@ ActiveRecord::Schema.define(version: 20170816203325) do t.integer "user_id" t.integer "payment_id" t.integer "week" + t.float "amount_paid" end create_table "ticket_scannings", force: :cascade do |t| From 0d70832f5bd6d5c60bf0bd7049c718fe00c17433 Mon Sep 17 00:00:00 2001 From: rahul Date: Mon, 25 Sep 2017 00:52:13 +0530 Subject: [PATCH 06/35] Add total amount spent by user User can see the total amount that he paid for the tickets and total amount spent by him on each ticket --- app/controllers/conference_registrations_controller.rb | 3 ++- app/models/ticket.rb | 5 +++++ app/views/conference_registrations/show.html.haml | 2 +- spec/controllers/conference_registration_controller_spec.rb | 4 ++-- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/app/controllers/conference_registrations_controller.rb b/app/controllers/conference_registrations_controller.rb index c2037318..e8809b28 100644 --- a/app/controllers/conference_registrations_controller.rb +++ b/app/controllers/conference_registrations_controller.rb @@ -27,8 +27,9 @@ class ConferenceRegistrationsController < ApplicationController end def show - @total_price = Ticket.total_price(@conference, current_user, paid: true) + @total_price = Ticket.total_price_user(@conference, current_user, paid: true) @tickets = current_user.ticket_purchases.by_conference(@conference).paid + @total_price_per_ticket = @tickets.group(:ticket_id).sum('amount_paid * quantity') @ticket_payments = @tickets.group_by(&:ticket_id) @total_quantity = @tickets.group(:ticket_id).sum(:quantity) end diff --git a/app/models/ticket.rb b/app/models/ticket.rb index ce527472..ac1d1927 100644 --- a/app/models/ticket.rb +++ b/app/models/ticket.rb @@ -55,6 +55,11 @@ class Ticket < ActiveRecord::Base result ? result : Money.new(0, 'USD') end + def self.total_price_user(conference, user, paid: false) + tickets = TicketPurchase.where(conference: conference, user: user, paid: paid) + tickets.inject(0){ |sum, ticket| sum + (ticket.amount_paid * ticket.quantity) } + end + def tickets_sold ticket_purchases.paid.sum(:quantity) end diff --git a/app/views/conference_registrations/show.html.haml b/app/views/conference_registrations/show.html.haml index 83d6d89c..a50cf198 100644 --- a/app/views/conference_registrations/show.html.haml +++ b/app/views/conference_registrations/show.html.haml @@ -101,7 +101,7 @@ = word_pluralize(@total_quantity[ticket_id], 'Ticket') for = tickets.first.price.symbol - = humanized_money tickets.first.price + = humanized_money @total_price_per_ticket[ticket_id] %br - if @tickets.any? = link_to 'Get more tickets', conference_tickets_path(@conference.short_title), class: "btn btn-default" diff --git a/spec/controllers/conference_registration_controller_spec.rb b/spec/controllers/conference_registration_controller_spec.rb index 9afaaed8..a6f1503c 100644 --- a/spec/controllers/conference_registration_controller_spec.rb +++ b/spec/controllers/conference_registration_controller_spec.rb @@ -252,7 +252,7 @@ describe ConferenceRegistrationsController, type: :controller do end it 'does not assign price of purchased tickets to total_price and purchased tickets to tickets without payment' do - expect(assigns(:total_price)).to eq Money.new(0, 'USD') + expect(assigns(:total_price)).to eq 0 end end @@ -262,7 +262,7 @@ describe ConferenceRegistrationsController, type: :controller do end it 'assigns 0 dollars to total_price and empty array to tickets variables' do - expect(assigns(:total_price)).to eq Money.new(0, 'USD') + expect(assigns(:total_price)).to eq 0 expect(assigns(:tickets)).to match_array [] end end From 03c9f7deb116d673ca3cf0662850df2a33b9b409 Mon Sep 17 00:00:00 2001 From: rahul Date: Mon, 25 Sep 2017 00:55:09 +0530 Subject: [PATCH 07/35] Add turnover for admin Admin can see the turnover amount for each ticket type. --- app/models/conference.rb | 2 +- app/models/ticket.rb | 9 +++++---- app/views/admin/tickets/index.html.haml | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/models/conference.rb b/app/models/conference.rb index 034e755b..c56161f2 100644 --- a/app/models/conference.rb +++ b/app/models/conference.rb @@ -496,7 +496,7 @@ class Conference < ActiveRecord::Base if tickets && ticket_purchases tickets.each do |ticket| result[ticket.title] = { - 'value' => ApplicationController.helpers.humanized_money(ticket.tickets_turnover).delete(',').to_i, + 'value' => ApplicationController.helpers.humanized_money(ticket.tickets_turnover_total(ticket.id)).delete(',').to_i, 'color' => "\##{Digest::MD5.hexdigest(ticket.title)[0..5]}" } end diff --git a/app/models/ticket.rb b/app/models/ticket.rb index ac1d1927..13646c9f 100644 --- a/app/models/ticket.rb +++ b/app/models/ticket.rb @@ -60,12 +60,13 @@ class Ticket < ActiveRecord::Base tickets.inject(0){ |sum, ticket| sum + (ticket.amount_paid * ticket.quantity) } end - def tickets_sold - ticket_purchases.paid.sum(:quantity) + def tickets_turnover_total(id) + tickets = TicketPurchase.where(ticket_id: id) + tickets.inject(0){ |sum, ticket| sum + (ticket.amount_paid * ticket.quantity) } end - def tickets_turnover - tickets_sold * price + def tickets_sold + ticket_purchases.paid.sum(:quantity) end private diff --git a/app/views/admin/tickets/index.html.haml b/app/views/admin/tickets/index.html.haml index 42154ae7..71698bb2 100644 --- a/app/views/admin/tickets/index.html.haml +++ b/app/views/admin/tickets/index.html.haml @@ -27,7 +27,7 @@ %td = ticket.tickets_sold %td - = humanized_money_with_symbol ticket.tickets_turnover + = humanized_money_with_symbol ticket.tickets_turnover_total(ticket.id) %td = ticket.registration_ticket? ? 'Yes' : 'No' %td From d00dc631f8a2570495eccdb9621a9d1cf405edf8 Mon Sep 17 00:00:00 2001 From: Naman Gupta <01namangupta@gmail.com> Date: Sat, 21 Oct 2017 02:42:08 +0530 Subject: [PATCH 08/35] Error opening link to difficulty level in Revision history is removed --- app/helpers/versions_helper.rb | 9 +++++++++ app/views/admin/versions/_object_desc_and_link.html.haml | 5 +---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/app/helpers/versions_helper.rb b/app/helpers/versions_helper.rb index 5788fe9d..7827a5ef 100644 --- a/app/helpers/versions_helper.rb +++ b/app/helpers/versions_helper.rb @@ -162,4 +162,13 @@ module VersionsHelper def users_role_change_description(version) version.event == 'create' ? 'added' : 'removed' end + + + def link_to_difficulty_level(version) + return 'deleted role' if version.conference_id.nil? + conference = Conference.find_by(id: version.conference_id) + difficulty_level = DifficultyLevel.find(version.item_id) + link_to difficulty_level.title, + admin_conference_program_difficulty_levels_path(conference.short_title) + end end diff --git a/app/views/admin/versions/_object_desc_and_link.html.haml b/app/views/admin/versions/_object_desc_and_link.html.haml index 4852a50f..7e24d8c2 100644 --- a/app/views/admin/versions/_object_desc_and_link.html.haml +++ b/app/views/admin/versions/_object_desc_and_link.html.haml @@ -207,10 +207,7 @@ - when 'DifficultyLevel' difficulty level - - difficulty_level = current_or_last_object_state(version.item_type, version.item_id) - = link_if_alive version, difficulty_level.title, - admin_conference_program_difficulty_level_path(conference_short_title, version.item_id), - conference + = link_to_difficulty_level(version) - when 'Splashpage' = link_if_alive version, 'splashpage', From 15813f9be642bcdd6e8a1de5c7735952ff0d294f Mon Sep 17 00:00:00 2001 From: Naman Gupta <01namangupta@gmail.com> Date: Sun, 22 Oct 2017 13:09:43 +0530 Subject: [PATCH 09/35] difficulty level code redundancy is removed --- app/helpers/versions_helper.rb | 10 +--------- .../admin/versions/_object_desc_and_link.html.haml | 10 +++++++++- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/helpers/versions_helper.rb b/app/helpers/versions_helper.rb index 7827a5ef..b1d6915d 100644 --- a/app/helpers/versions_helper.rb +++ b/app/helpers/versions_helper.rb @@ -162,13 +162,5 @@ module VersionsHelper def users_role_change_description(version) version.event == 'create' ? 'added' : 'removed' end - - - def link_to_difficulty_level(version) - return 'deleted role' if version.conference_id.nil? - conference = Conference.find_by(id: version.conference_id) - difficulty_level = DifficultyLevel.find(version.item_id) - link_to difficulty_level.title, - admin_conference_program_difficulty_levels_path(conference.short_title) - end + end diff --git a/app/views/admin/versions/_object_desc_and_link.html.haml b/app/views/admin/versions/_object_desc_and_link.html.haml index 7e24d8c2..ef791dd1 100644 --- a/app/views/admin/versions/_object_desc_and_link.html.haml +++ b/app/views/admin/versions/_object_desc_and_link.html.haml @@ -207,7 +207,15 @@ - when 'DifficultyLevel' difficulty level - = link_to_difficulty_level(version) + - difficulty_level = DifficultyLevel.find_by(id: version.item_id) + - if difficulty_level.nil? + = 'Difficulty Level Deleted' + - else + - conference = Conference.find_by(id: version.conference_id) + - unless conference.nil? + = link_to difficulty_level.title, admin_conference_program_difficulty_levels_path(conference.short_title) + - else + = difficulty_level.title - when 'Splashpage' = link_if_alive version, 'splashpage', From 0cd8d21611aa70edd6abfdf007ac2463a33cacaa Mon Sep 17 00:00:00 2001 From: Naman Gupta <01namangupta@gmail.com> Date: Sun, 22 Oct 2017 16:30:54 +0530 Subject: [PATCH 10/35] minor changes --- app/helpers/versions_helper.rb | 3 +-- .../admin/versions/_object_desc_and_link.html.haml | 11 ++--------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/app/helpers/versions_helper.rb b/app/helpers/versions_helper.rb index b1d6915d..1baca035 100644 --- a/app/helpers/versions_helper.rb +++ b/app/helpers/versions_helper.rb @@ -162,5 +162,4 @@ module VersionsHelper def users_role_change_description(version) version.event == 'create' ? 'added' : 'removed' end - -end +end \ No newline at end of file diff --git a/app/views/admin/versions/_object_desc_and_link.html.haml b/app/views/admin/versions/_object_desc_and_link.html.haml index ef791dd1..6b182c2f 100644 --- a/app/views/admin/versions/_object_desc_and_link.html.haml +++ b/app/views/admin/versions/_object_desc_and_link.html.haml @@ -207,15 +207,8 @@ - when 'DifficultyLevel' difficulty level - - difficulty_level = DifficultyLevel.find_by(id: version.item_id) - - if difficulty_level.nil? - = 'Difficulty Level Deleted' - - else - - conference = Conference.find_by(id: version.conference_id) - - unless conference.nil? - = link_to difficulty_level.title, admin_conference_program_difficulty_levels_path(conference.short_title) - - else - = difficulty_level.title + - difficulty_level = current_or_last_object_state(version.item_type, version.item_id) + = link_if_alive version, difficulty_level.title,admin_conference_program_difficulty_levels_path(conference_short_title), conference - when 'Splashpage' = link_if_alive version, 'splashpage', From 77d8bfe49643bb593b6195843956bf2569b9b799 Mon Sep 17 00:00:00 2001 From: Naman Gupta <01namangupta@gmail.com> Date: Sun, 22 Oct 2017 17:02:17 +0530 Subject: [PATCH 11/35] styling failing error is corrected minor changes --- app/helpers/versions_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/versions_helper.rb b/app/helpers/versions_helper.rb index 1baca035..5788fe9d 100644 --- a/app/helpers/versions_helper.rb +++ b/app/helpers/versions_helper.rb @@ -162,4 +162,4 @@ module VersionsHelper def users_role_change_description(version) version.event == 'create' ? 'added' : 'removed' end -end \ No newline at end of file +end From 01abbfecc4cb2d68c47328f4f6d6a6456a971012 Mon Sep 17 00:00:00 2001 From: namangupta01 <01namangupta@gmail.com> Date: Fri, 4 Aug 2017 01:29:30 +0530 Subject: [PATCH 12/35] Speaker is ask to register only when registration_period is set --- app/views/proposals/index.html.haml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/views/proposals/index.html.haml b/app/views/proposals/index.html.haml index 5ed332dc..43b17199 100644 --- a/app/views/proposals/index.html.haml +++ b/app/views/proposals/index.html.haml @@ -49,6 +49,7 @@ %br It will also be more likely that visitors find your proposal interesting enough to attend. + - if Conference.where(short_title: params[:conference_id]).first.registration_period %p %strong Why do I need to register to the conference? @@ -73,7 +74,8 @@ = link_to registered_text(event), registrations_conference_program_proposal_path(@conference.short_title, event), class: 'btn btn-xs btn-danger' %td.col-md-2{style: "padding:20px 8px 20px 8px;"} - = link_to 'Complete your proposal', 'javascript: void(0)', "type"=>"button", "data-trigger"=>"focus", "data-toggle"=>"popover", "title"=>"Your todo list", "data-content"=>"#{render partial: 'tooltip', locals: { event: event} }" + - if Conference.where(short_title: params[:conference_id]).first.registration_period + = link_to 'Complete your proposal', 'javascript: void(0)', "type"=>"button", "data-trigger"=>"focus", "data-toggle"=>"popover", "title"=>"Your todo list", "data-content"=>"#{render partial: 'tooltip', locals: { event: event} }" - progress_percentage = event.calculate_progress .progress From b1f32caf7cef65358aff15d70f42f90b9848892c Mon Sep 17 00:00:00 2001 From: namangupta01 <01namangupta@gmail.com> Date: Sun, 6 Aug 2017 01:13:14 +0530 Subject: [PATCH 13/35] speaker is only ask to register when registrations are open and speaker haven't registered yet --- app/views/proposals/_tooltip.html.haml | 13 +++++----- app/views/proposals/index.html.haml | 36 ++++++++++++++------------ 2 files changed, 27 insertions(+), 22 deletions(-) diff --git a/app/views/proposals/_tooltip.html.haml b/app/views/proposals/_tooltip.html.haml index 168d2d26..dba9c991 100644 --- a/app/views/proposals/_tooltip.html.haml +++ b/app/views/proposals/_tooltip.html.haml @@ -1,11 +1,12 @@ - progress_status = event.progress_status %ul.list-unstyled - %li{'class'=>class_for_todo(progress_status['registered'])} - %span{'class'=>icon_for_todo(progress_status['registered'])} - - if progress_status['registered'] - Speaker(s) registered to the conference - - else - = link_to 'Speaker(s) not registered to the conference', new_conference_conference_registration_path(event.program.conference.short_title) + - if @conference.registration_open? || (@conference.user_registered? current_user) + %li{'class'=>class_for_todo(progress_status['registered'])} + %span{'class'=>icon_for_todo(progress_status['registered'])} + - if progress_status['registered'] + Speaker(s) registered to the conference + - else + = link_to 'Speaker(s) not registered to the conference', new_conference_conference_registration_path(event.program.conference.short_title) %li{'class'=>class_for_todo(progress_status['biographies'])} %span{'class'=>icon_for_todo(progress_status['biographies'])} - if progress_status['biographies'] diff --git a/app/views/proposals/index.html.haml b/app/views/proposals/index.html.haml index 43b17199..ac833747 100644 --- a/app/views/proposals/index.html.haml +++ b/app/views/proposals/index.html.haml @@ -48,13 +48,12 @@ The more information you add to your proposal, the more likely it is that the conference organizers accept your proposal. %br It will also be more likely that visitors find your proposal interesting enough to attend. - - - if Conference.where(short_title: params[:conference_id]).first.registration_period - %p - %strong - Why do I need to register to the conference? - %p - Knowing the number of visitors for the conference helps the organizers plan better. + - if (@conference.registration_open?) && !(@conference.user_registered? current_user) + %p + %strong + Why do I need to register to the conference? + %p + Knowing the number of visitors for the conference helps the organizers plan better. %table.table.table-striped#events - @events.each do |event| @@ -74,15 +73,20 @@ = link_to registered_text(event), registrations_conference_program_proposal_path(@conference.short_title, event), class: 'btn btn-xs btn-danger' %td.col-md-2{style: "padding:20px 8px 20px 8px;"} - - if Conference.where(short_title: params[:conference_id]).first.registration_period - = link_to 'Complete your proposal', 'javascript: void(0)', "type"=>"button", "data-trigger"=>"focus", "data-toggle"=>"popover", "title"=>"Your todo list", "data-content"=>"#{render partial: 'tooltip', locals: { event: event} }" - - - progress_percentage = event.calculate_progress - .progress - %div{class: "progress-bar #{event_progress_color(progress_percentage)}", style: "width:#{progress_percentage}%;"} - = event.progress_status.reject{ |_key, value| value || value.nil? }.length - left - + = link_to 'Complete your proposal', 'javascript: void(0)', "type"=>"button", "data-trigger"=>"focus", "data-toggle"=>"popover", "title"=>"Your todo list", "data-content"=>"#{render partial: 'tooltip', locals: { event: event} }" + - if (@conference.registration_open?) || (@conference.user_registered? current_user) + - progress_percentage = event.calculate_progress + .progress + %div{class: "progress-bar #{event_progress_color(progress_percentage)}", style: "width:#{progress_percentage}%;"} + = event.progress_status.reject{ |_key, value| value || value.nil? }.length + left + - else + - progress_list = event.progress_status + - progress_percentage = (100 * progress_list.values.count(true) / (progress_list.values.compact.count-1)).to_s + .progress + %div{class: "progress-bar #{event_progress_color(progress_percentage)}", style: "width:#{progress_percentage}%;"} + = event.progress_status.reject{ |_key, value| value || value.nil? }.length-1 + left %td.col-md-3{style: "padding:20px 0px 20px 0px;"} .pull-right - if event.transition_possible? :confirm From e607aca68015b7cd339496311e92b62941df00a9 Mon Sep 17 00:00:00 2001 From: Your Name <01namangupta@gmail.com> Date: Fri, 13 Oct 2017 02:39:36 +0530 Subject: [PATCH 14/35] user ability for registration is used for chcking whether a user can register or not --- app/views/proposals/_tooltip.html.haml | 2 +- app/views/proposals/index.html.haml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/proposals/_tooltip.html.haml b/app/views/proposals/_tooltip.html.haml index dba9c991..b10b5a7a 100644 --- a/app/views/proposals/_tooltip.html.haml +++ b/app/views/proposals/_tooltip.html.haml @@ -1,6 +1,6 @@ - progress_status = event.progress_status %ul.list-unstyled - - if @conference.registration_open? || (@conference.user_registered? current_user) + - if can? :create, @conference.registrations.new %li{'class'=>class_for_todo(progress_status['registered'])} %span{'class'=>icon_for_todo(progress_status['registered'])} - if progress_status['registered'] diff --git a/app/views/proposals/index.html.haml b/app/views/proposals/index.html.haml index ac833747..d22c325e 100644 --- a/app/views/proposals/index.html.haml +++ b/app/views/proposals/index.html.haml @@ -48,7 +48,7 @@ The more information you add to your proposal, the more likely it is that the conference organizers accept your proposal. %br It will also be more likely that visitors find your proposal interesting enough to attend. - - if (@conference.registration_open?) && !(@conference.user_registered? current_user) + - if can? :create, @conference.registrations.new %p %strong Why do I need to register to the conference? @@ -74,7 +74,7 @@ %td.col-md-2{style: "padding:20px 8px 20px 8px;"} = link_to 'Complete your proposal', 'javascript: void(0)', "type"=>"button", "data-trigger"=>"focus", "data-toggle"=>"popover", "title"=>"Your todo list", "data-content"=>"#{render partial: 'tooltip', locals: { event: event} }" - - if (@conference.registration_open?) || (@conference.user_registered? current_user) + - if can? :create, @conference.registrations.new - progress_percentage = event.calculate_progress .progress %div{class: "progress-bar #{event_progress_color(progress_percentage)}", style: "width:#{progress_percentage}%;"} From a0e3ea75ed1958fe93a0f607f729f10825ceee8c Mon Sep 17 00:00:00 2001 From: Naman Gupta <01namangupta@gmail.com> Date: Thu, 2 Nov 2017 21:44:12 +0530 Subject: [PATCH 15/35] consecutive ruby lines are made into the ruby filter --- app/views/proposals/index.html.haml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/views/proposals/index.html.haml b/app/views/proposals/index.html.haml index d22c325e..bc704296 100644 --- a/app/views/proposals/index.html.haml +++ b/app/views/proposals/index.html.haml @@ -67,7 +67,7 @@ %small.text-muted = event.event_type.title = "(#{event.event_type.length} min)" - = "in #{event.track.name}" if event.track + = "in #{event.traistck.name}" if event.track - if event.require_registration %br = link_to registered_text(event), registrations_conference_program_proposal_path(@conference.short_title, event), class: 'btn btn-xs btn-danger' @@ -81,8 +81,9 @@ = event.progress_status.reject{ |_key, value| value || value.nil? }.length left - else - - progress_list = event.progress_status - - progress_percentage = (100 * progress_list.values.count(true) / (progress_list.values.compact.count-1)).to_s + :ruby + progress_list = event.progress_status + progress_percentage = (100 * progress_list.values.count(true) / (progress_list.values.compact.count-1)).to_s .progress %div{class: "progress-bar #{event_progress_color(progress_percentage)}", style: "width:#{progress_percentage}%;"} = event.progress_status.reject{ |_key, value| value || value.nil? }.length-1 From 02709597a284e8b83c4ed67a1d01f774343d82e1 Mon Sep 17 00:00:00 2001 From: Adriano Vieira Date: Sat, 4 Nov 2017 22:13:19 -0200 Subject: [PATCH 16/35] Update bootstrap for centos box --- bootstrap.sh | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/bootstrap.sh b/bootstrap.sh index 92a8d746..f65ba6e2 100644 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -1,4 +1,10 @@ #!/bin/bash + +# set env os release variables +. /etc/os-release + +if [[ "$ID" == "opensuse" ]]; then + pushd /vagrant echo -e "\ninstalling required software packages...\n" @@ -14,6 +20,37 @@ echo 'install: --no-format-executable' >> /etc/gemrc echo -e "\ninstalling bundler...\n" gem.ruby2.4 install bundler +elif [[ "$ID" == "centos" || "$VERSION" == "7" ]]; then + _YELLOW='\033[1;33m' # yellow color + _LRED='\033[1;31m' # Light red color + _NO_COLOUR='\033[0m' # no color + + printf "${_YELLOW}CEntOS-7 Setup${_NO_COLOUR}\n" + + printf "${_YELLOW}installing ruby-2.4${_NO_COLOUR}\n" + yum install -q -y https://github.com/feedforce/ruby-rpm/releases/download/2.4.2/ruby-2.4.2-1.el7.centos.x86_64.rpm + if [[ ! "$?" -eq 0 ]]; then + printf "${_LRED}Error trying to install ruby-2.4${_NO_COLOUR}\n" + fi + + printf "${_YELLOW}installing ruby-2.4 gems dependencies${_NO_COLOUR}\n" + gem install bundler + if [[ ! "$?" -eq 0 ]]; then + printf "${_LRED}Error trying to install ruby-2.4 bundler${_NO_COLOUR}\n" + fi + + printf "${_YELLOW}installing nodejs repo${_NO_COLOUR}\n" + curl -sL https://rpm.nodesource.com/setup_9.x | bash - > /dev/null + + printf "${_YELLOW}installing nodejs and devel tools${_NO_COLOUR}\n" + yum install -q -y git make gcc gcc-c++ libxml2-devel libxslt-devel nodejs screen mariadb mariadb-devel sqlite-devel ImageMagick + + # for production: bundle install --without test development + printf "${_YELLOW}Opening firewall port: 3000${_NO_COLOUR}\n" + iptables -I INPUT -p tcp --dport 3000 -j ACCEPT + +fi + echo -e "\ninstalling your bundle...\n" su - vagrant -c "cd /vagrant/; bundle install --quiet" From c4fad4a181b1f10e961b342ff42c8a96933a008d Mon Sep 17 00:00:00 2001 From: Adriano Vieira Date: Sun, 5 Nov 2017 00:55:07 -0200 Subject: [PATCH 17/35] Update bootstrap to install phantomjs on centos --- bootstrap.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bootstrap.sh b/bootstrap.sh index f65ba6e2..06a642dd 100644 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -43,12 +43,17 @@ elif [[ "$ID" == "centos" || "$VERSION" == "7" ]]; then curl -sL https://rpm.nodesource.com/setup_9.x | bash - > /dev/null printf "${_YELLOW}installing nodejs and devel tools${_NO_COLOUR}\n" - yum install -q -y git make gcc gcc-c++ libxml2-devel libxslt-devel nodejs screen mariadb mariadb-devel sqlite-devel ImageMagick + yum install -q -y git make gcc gcc-c++ libxml2-devel libxslt-devel nodejs screen mariadb mariadb-devel sqlite-devel ImageMagick bzip2 # for production: bundle install --without test development printf "${_YELLOW}Opening firewall port: 3000${_NO_COLOUR}\n" iptables -I INPUT -p tcp --dport 3000 -j ACCEPT + printf "${_YELLOW}installing phantomjs${_NO_COLOUR}\n" + curl -L --silent https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2 -o /tmp/phantomjs-2.1.1-linux-x86_64.tar.bz2 + tar jxvf /tmp/phantomjs-2.1.1-linux-x86_64.tar.bz2 -C /tmp/ phantomjs-2.1.1-linux-x86_64/bin/phantomjs + mv /tmp/phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/local/bin + fi echo -e "\ninstalling your bundle...\n" From be1992a03af2766aef4d39276e34fb3814f882da Mon Sep 17 00:00:00 2001 From: Naman Gupta <01namangupta@gmail.com> Date: Sun, 5 Nov 2017 11:31:17 +0530 Subject: [PATCH 18/35] typos is fixed --- app/views/proposals/index.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/proposals/index.html.haml b/app/views/proposals/index.html.haml index bc704296..97a721c0 100644 --- a/app/views/proposals/index.html.haml +++ b/app/views/proposals/index.html.haml @@ -67,7 +67,7 @@ %small.text-muted = event.event_type.title = "(#{event.event_type.length} min)" - = "in #{event.traistck.name}" if event.track + = "in #{event.track.name}" if event.track - if event.require_registration %br = link_to registered_text(event), registrations_conference_program_proposal_path(@conference.short_title, event), class: 'btn btn-xs btn-danger' From e99287d18a7eafb5429fe0f5514689691e4bba73 Mon Sep 17 00:00:00 2001 From: Your Name <01namangupta@gmail.com> Date: Mon, 9 Oct 2017 17:46:39 +0530 Subject: [PATCH 19/35] export feature for tracks and booths are done --- app/controllers/admin/booths_controller.rb | 19 +++++++++++- app/controllers/admin/tracks_controller.rb | 20 ++++++++++++- app/views/admin/booths/_all_booths.csv.haml | 19 ++++++++++++ app/views/admin/booths/_all_booths.pdf.prawn | 26 +++++++++++++++++ app/views/admin/booths/_all_booths.xlsx.axlsx | 27 +++++++++++++++++ .../admin/booths/_confirmed_booths.csv.haml | 19 ++++++++++++ .../admin/booths/_confirmed_booths.pdf.prawn | 26 +++++++++++++++++ .../admin/booths/_confirmed_booths.xlsx.axlsx | 27 +++++++++++++++++ app/views/admin/booths/booths.csv.haml | 4 +++ app/views/admin/booths/booths.pdf.prawn | 5 ++++ app/views/admin/booths/booths.xlsx.axlsx | 7 +++++ app/views/admin/booths/index.html.haml | 24 +++++++++++++++ app/views/admin/tracks/_all_tracks.csv.haml | 21 ++++++++++++++ app/views/admin/tracks/_all_tracks.pdf.prawn | 28 ++++++++++++++++++ app/views/admin/tracks/_all_tracks.xlsx.axlsx | 29 +++++++++++++++++++ .../admin/tracks/_confirmed_tracks.csv.haml | 21 ++++++++++++++ .../admin/tracks/_confirmed_tracks.pdf.prawn | 28 ++++++++++++++++++ .../admin/tracks/_confirmed_tracks.xlsx.axlsx | 29 +++++++++++++++++++ app/views/admin/tracks/index.html.haml | 27 ++++++++++++++++- app/views/admin/tracks/tracks.csv.haml | 4 +++ app/views/admin/tracks/tracks.pdf.prawn | 5 ++++ app/views/admin/tracks/tracks.xlsx.axlsx | 6 ++++ 22 files changed, 418 insertions(+), 3 deletions(-) create mode 100644 app/views/admin/booths/_all_booths.csv.haml create mode 100644 app/views/admin/booths/_all_booths.pdf.prawn create mode 100644 app/views/admin/booths/_all_booths.xlsx.axlsx create mode 100644 app/views/admin/booths/_confirmed_booths.csv.haml create mode 100644 app/views/admin/booths/_confirmed_booths.pdf.prawn create mode 100644 app/views/admin/booths/_confirmed_booths.xlsx.axlsx create mode 100644 app/views/admin/booths/booths.csv.haml create mode 100644 app/views/admin/booths/booths.pdf.prawn create mode 100644 app/views/admin/booths/booths.xlsx.axlsx create mode 100644 app/views/admin/tracks/_all_tracks.csv.haml create mode 100644 app/views/admin/tracks/_all_tracks.pdf.prawn create mode 100644 app/views/admin/tracks/_all_tracks.xlsx.axlsx create mode 100644 app/views/admin/tracks/_confirmed_tracks.csv.haml create mode 100644 app/views/admin/tracks/_confirmed_tracks.pdf.prawn create mode 100644 app/views/admin/tracks/_confirmed_tracks.xlsx.axlsx create mode 100644 app/views/admin/tracks/tracks.csv.haml create mode 100644 app/views/admin/tracks/tracks.pdf.prawn create mode 100644 app/views/admin/tracks/tracks.xlsx.axlsx diff --git a/app/controllers/admin/booths_controller.rb b/app/controllers/admin/booths_controller.rb index 102eb10b..e41d11d3 100644 --- a/app/controllers/admin/booths_controller.rb +++ b/app/controllers/admin/booths_controller.rb @@ -3,7 +3,24 @@ module Admin load_and_authorize_resource :conference, find_by: :short_title load_and_authorize_resource through: :conference - def index; end + def index + @file_name = "booths_for_#{@conference.short_title}" + @booth_export_option = params[:booth_export_option] + respond_to do |format| + format.html + # Explicity call #to_json to avoid the use of EventSerializer + format.json { render json: Booth.where(state: :confirmed, program: @program).to_json } + format.xlsx do + response.headers['Content-Disposition'] = "attachment; filename=\"#{@file_name}.xlsx\"" + render 'booths' + end + format.pdf { render 'booths' } + format.csv do + response.headers['Content-Disposition'] = "attachment; filename=\"#{@file_name}.csv\"" + render 'booths' + end + end + end def show; end diff --git a/app/controllers/admin/tracks_controller.rb b/app/controllers/admin/tracks_controller.rb index 7352ee35..4692f9a1 100644 --- a/app/controllers/admin/tracks_controller.rb +++ b/app/controllers/admin/tracks_controller.rb @@ -7,7 +7,25 @@ module Admin # Show flash message with ajax calls after_action :prepare_unobtrusive_flash, only: :toggle_cfp_inclusion - def index; end + def index + @file_name = "tracks_for_#{@conference.short_title}" + @track_export_option = params[:track_export_option] + + respond_to do |format| + format.html + # Explicity call #to_json to avoid the use of EventSerializer + format.json { render json: Track.where(state: :confirmed, program: @program).to_json } + format.xlsx do + response.headers['Content-Disposition'] = "attachment; filename=\"#{@file_name}.xlsx\"" + render 'tracks' + end + format.pdf { render 'tracks' } + format.csv do + response.headers['Content-Disposition'] = "attachment; filename=\"#{@file_name}.csv\"" + render 'tracks' + end + end + end def show respond_to do |format| diff --git a/app/views/admin/booths/_all_booths.csv.haml b/app/views/admin/booths/_all_booths.csv.haml new file mode 100644 index 00000000..7a6f10fd --- /dev/null +++ b/app/views/admin/booths/_all_booths.csv.haml @@ -0,0 +1,19 @@ +- headers = ['Booth ID', + 'Title', + 'Description', + 'Reasoning', + 'Submitter Name', + 'Submitter Relationship', + 'Website Url', + 'State'] += CSV.generate_line ['All booths'] += CSV.generate_line headers +- @booths.each do |booth| + = CSV.generate_line([booth.id, + booth.title, + booth.description, + booth.reasoning, + booth.submitter.name, + booth.submitter_relationship, + booth.website_url, + booth.state]).html_safe diff --git a/app/views/admin/booths/_all_booths.pdf.prawn b/app/views/admin/booths/_all_booths.pdf.prawn new file mode 100644 index 00000000..168397e8 --- /dev/null +++ b/app/views/admin/booths/_all_booths.pdf.prawn @@ -0,0 +1,26 @@ +prawn_document(force_download: true, filename: "#{@file_name}.pdf", page_layout: :landscape) do |pdf| + booths_array = [] + header_array = ['Booth ID', + 'Title', + 'Description', + 'Reasoning', + 'Submitter Name', + 'Submitter Relationship', + 'Website Url', + 'State'] + booths_array << header_array + @booths.each do |booth| + row = [] + row << booth.id + row << booth.title + row << booth.description + row << booth.reasoning + row << booth.submitter.name + row << booth.submitter_relationship + row << booth.website_url + row << booth.state + booths_array << row + end + pdf.text "#{@conference.short_title} booths", font_size: 25, align: :center + pdf.table booths_array, header: true, cell_style: {size: 8, border_width: 1},column_widths: [45,70,153,152,70,80,105,45] +end diff --git a/app/views/admin/booths/_all_booths.xlsx.axlsx b/app/views/admin/booths/_all_booths.xlsx.axlsx new file mode 100644 index 00000000..bd1cc1db --- /dev/null +++ b/app/views/admin/booths/_all_booths.xlsx.axlsx @@ -0,0 +1,27 @@ +wb.add_worksheet(name: 'all booths') do |sheet| + bold_style = wb.styles.add_style(b: true) + wrap_text = wb.styles.add_style alignment: {wrap_text: true} + row = ['Booth ID', + 'Title', + 'Description', + 'Reasoning', + 'Submitter Name', + 'Submitter Relationship', + 'Website Url', + 'State'] + + sheet.add_row row, style: bold_style + @booths.each do |booth| + row = [] + row << booth.id + row << booth.title + row << booth.description + row << booth.reasoning + row << booth.submitter.name + row << booth.submitter_relationship + row << booth.website_url + row << booth.state + sheet.add_row row , style: wrap_text + sheet.column_widths 10,20,35,35,20,30,35,10 + end +end diff --git a/app/views/admin/booths/_confirmed_booths.csv.haml b/app/views/admin/booths/_confirmed_booths.csv.haml new file mode 100644 index 00000000..b5d17eb4 --- /dev/null +++ b/app/views/admin/booths/_confirmed_booths.csv.haml @@ -0,0 +1,19 @@ +- headers = ['Booth ID', + 'Title', + 'Description', + 'Reasoning', + 'Submitter Name', + 'Submitter Relationship', + 'Website Url', + 'State'] += CSV.generate_line ['All booths'] += CSV.generate_line headers +- @booths.confirmed.each do |booth| + = CSV.generate_line([booth.id, + booth.title, + booth.description, + booth.reasoning, + booth.submitter.name, + booth.submitter_relationship, + booth.website_url, + booth.state]).html_safe diff --git a/app/views/admin/booths/_confirmed_booths.pdf.prawn b/app/views/admin/booths/_confirmed_booths.pdf.prawn new file mode 100644 index 00000000..a9750ab9 --- /dev/null +++ b/app/views/admin/booths/_confirmed_booths.pdf.prawn @@ -0,0 +1,26 @@ +prawn_document(force_download: true, filename: "#{@file_name}.pdf", page_layout: :landscape) do |pdf| + booths_array = [] + header_array = ['Booth ID', + 'Title', + 'Description', + 'Reasoning', + 'Submitter Name', + 'Submitter Relationship', + 'Website Url', + 'State'] + booths_array << header_array + @booths.confirmed.each do |booth| + row = [] + row << booth.id + row << booth.title + row << booth.description + row << booth.reasoning + row << booth.submitter.name + row << booth.submitter_relationship + row << booth.website_url + row << booth.state + booths_array << row + end + pdf.text "#{@conference.short_title} booths", font_size: 25, align: :center + pdf.table booths_array, header: true, cell_style: {size: 8, border_width: 1},column_widths: [45,70,153,152,70,80,105,45] +end diff --git a/app/views/admin/booths/_confirmed_booths.xlsx.axlsx b/app/views/admin/booths/_confirmed_booths.xlsx.axlsx new file mode 100644 index 00000000..2dc10013 --- /dev/null +++ b/app/views/admin/booths/_confirmed_booths.xlsx.axlsx @@ -0,0 +1,27 @@ +wb.add_worksheet(name: 'all booths') do |sheet| + bold_style = wb.styles.add_style(b: true) + wrap_text = wb.styles.add_style alignment: {wrap_text: true} + row = ['Booth ID', + 'Title', + 'Description', + 'Reasoning', + 'Submitter Name', + 'Submitter Relationship', + 'Website Url', + 'State'] + sheet.add_row row, style: bold_style + + @booths.confirmed.each do |booth| + row = [] + row << booth.id + row << booth.title + row << booth.description + row << booth.reasoning + row << booth.submitter.name + row << booth.submitter_relationship + row << booth.website_url + row << booth.state + sheet.add_row row , style: wrap_text + sheet.column_widths 10,20,35,35,20,30,35,10 + end +end diff --git a/app/views/admin/booths/booths.csv.haml b/app/views/admin/booths/booths.csv.haml new file mode 100644 index 00000000..27d1d354 --- /dev/null +++ b/app/views/admin/booths/booths.csv.haml @@ -0,0 +1,4 @@ +- if @booth_export_option == 'confirmed' + = render 'confirmed_booths' +- elsif @booth_export_option == 'all' + = render 'all_booths' diff --git a/app/views/admin/booths/booths.pdf.prawn b/app/views/admin/booths/booths.pdf.prawn new file mode 100644 index 00000000..5c8f9bd2 --- /dev/null +++ b/app/views/admin/booths/booths.pdf.prawn @@ -0,0 +1,5 @@ +if @booth_export_option == 'confirmed' + render 'confirmed_booths' +elsif @booth_export_option == 'all' + render 'all_booths' +end diff --git a/app/views/admin/booths/booths.xlsx.axlsx b/app/views/admin/booths/booths.xlsx.axlsx new file mode 100644 index 00000000..5fe084db --- /dev/null +++ b/app/views/admin/booths/booths.xlsx.axlsx @@ -0,0 +1,7 @@ +wb = xlsx_package.workbook +xlsx_package.use_autowidth = true +if @booth_export_option == 'confirmed' + render partial: 'confirmed_booths', locals: { wb: wb } +elsif @booth_export_option == 'all' + render partial: 'all_booths', locals: { wb: wb } +end diff --git a/app/views/admin/booths/index.html.haml b/app/views/admin/booths/index.html.haml index 428895e5..431b6dfc 100644 --- a/app/views/admin/booths/index.html.haml +++ b/app/views/admin/booths/index.html.haml @@ -3,6 +3,30 @@ .page-header %h1 Booths + .pull-right + - if can? :read, Booth + .btn-group + .btn-group + %button.btn.btn-default.dropdown-toggle{ 'data-toggle' => 'dropdown', type: 'button', class: 'btn btn-success' } + Export PDF + %span.caret + %ul.dropdown-menu{ role: 'menu' } + %li= link_to 'All Booths', admin_conference_booths_path(@conference.short_title, format: :pdf, booth_export_option: 'all') + %li= link_to 'Confirmed Booths', admin_conference_booths_path(@conference.short_title, format: :pdf, booth_export_option: 'confirmed') + .btn-group + %button.btn.btn-default.dropdown-toggle{ 'data-toggle' => 'dropdown', type: 'button', class: 'btn btn-success' } + Export CSV + %span.caret + %ul.dropdown-menu{ role: 'menu' } + %li= link_to 'All', admin_conference_booths_path(@conference.short_title, format: :csv, booth_export_option: 'all') + %li= link_to 'Confirmed', admin_conference_booths_path(@conference.short_title, format: :csv, booth_export_option: 'confirmed') + .btn-group + %button.btn.btn-default.dropdown-toggle{ 'data-toggle' => 'dropdown', type: 'button', class: 'btn btn-success' } + Export XLS + %span.caret + %ul.dropdown-menu{ role: 'menu' } + %li= link_to 'All', admin_conference_booths_path(@conference.short_title, format: :xlsx, booth_export_option: 'all') + %li= link_to 'Confirmed', admin_conference_booths_path(@conference.short_title, format: :xlsx, booth_export_option: 'confirmed') = "(#{@booths.length})" if @booths.any? %p.text-muted All the booth requests diff --git a/app/views/admin/tracks/_all_tracks.csv.haml b/app/views/admin/tracks/_all_tracks.csv.haml new file mode 100644 index 00000000..a2361231 --- /dev/null +++ b/app/views/admin/tracks/_all_tracks.csv.haml @@ -0,0 +1,21 @@ +- headers = ['Track ID', + 'Name', + 'Description', + 'Room', + 'Start Date', + 'Start Date', + 'Submitter Name', + 'Included in Cfp', + 'State'] += CSV.generate_line ['All Tracks'] += CSV.generate_line headers +- @tracks.each do |track| + = CSV.generate_line([track.id, + track.name, + track.description, + track.try(:room).try(:name), + track.start_date, + track.end_date, + track.try(:submitter).try(:name), + track.cfp_active? ? 'Yes' : 'No', + track.state]).html_safe diff --git a/app/views/admin/tracks/_all_tracks.pdf.prawn b/app/views/admin/tracks/_all_tracks.pdf.prawn new file mode 100644 index 00000000..885c4d28 --- /dev/null +++ b/app/views/admin/tracks/_all_tracks.pdf.prawn @@ -0,0 +1,28 @@ +prawn_document(force_download: true, filename: "#{@file_name}.pdf", page_layout: :landscape) do |pdf| + tracks_array = [] + header_array = ['Track ID', + 'Name', + 'Description', + 'Room', + 'Start Date', + 'End Date', + 'Submitter Name', + 'Included in Cfp', + 'State'] + tracks_array << header_array + @tracks.each do |track| + row = [] + row << track.id + row << track.name.to_s + row << track.description.to_s + row << track.try(:room).try(:name) + row << track.start_date.to_s + row << track.end_date.to_s + row << track.try(:submitter).try(:name) + row << (track.cfp_active? ? 'Yes' : 'No') + row << track.state + tracks_array << row + end + pdf.text "#{@conference.short_title} tracks", font_size: 25, align: :center + pdf.table tracks_array, header: true, cell_style: {size: 8, border_width: 1},column_widths: [40,70,230,65,55,55,90,65,50] +end diff --git a/app/views/admin/tracks/_all_tracks.xlsx.axlsx b/app/views/admin/tracks/_all_tracks.xlsx.axlsx new file mode 100644 index 00000000..d1397193 --- /dev/null +++ b/app/views/admin/tracks/_all_tracks.xlsx.axlsx @@ -0,0 +1,29 @@ +wb.add_worksheet(name: 'all tracks') do |sheet| + bold_style = wb.styles.add_style(b: true) + wrap_text = wb.styles.add_style alignment: {wrap_text: true} + row = ['Track ID', + 'Name', + 'Description', + 'Room', + 'Start Date', + 'End Date', + 'Submitter Name', + 'Included in Cfp', + 'State'] + sheet.add_row row, style: bold_style + + @tracks.each do |track| + row = [] + row << track.id + row << track.name.to_s + row << track.description.to_s + row << track.try(:room).try(:name) + row << track.start_date.to_s + row << track.end_date.to_s + row << track.try(:submitter).try(:name) + row << (track.cfp_active? ? 'Yes' : 'No') + row << track.state + sheet.add_row row , style: wrap_text + sheet.column_widths 10,20,50,20,12,12,20,15,10 + end +end diff --git a/app/views/admin/tracks/_confirmed_tracks.csv.haml b/app/views/admin/tracks/_confirmed_tracks.csv.haml new file mode 100644 index 00000000..b2bd3f85 --- /dev/null +++ b/app/views/admin/tracks/_confirmed_tracks.csv.haml @@ -0,0 +1,21 @@ +- headers = ['Track ID', + 'Name', + 'Description', + 'Room', + 'Start Date', + 'Start Date', + 'Submitter Name', + 'Included in Cfp', + 'State'] += CSV.generate_line ['Confirmed Tracks'] += CSV.generate_line headers +- @tracks.confirmed.each do |track| + = CSV.generate_line([track.id, + track.name, + track.description, + track.try(:room).try(:name), + track.start_date, + track.end_date, + track.try(:submitter).try(:name), + track.cfp_active? ? 'Yes' : 'No', + track.state]).html_safe diff --git a/app/views/admin/tracks/_confirmed_tracks.pdf.prawn b/app/views/admin/tracks/_confirmed_tracks.pdf.prawn new file mode 100644 index 00000000..290014a8 --- /dev/null +++ b/app/views/admin/tracks/_confirmed_tracks.pdf.prawn @@ -0,0 +1,28 @@ +prawn_document(force_download: true, filename: "#{@file_name}.pdf", page_layout: :landscape) do |pdf| + tracks_array = [] + header_array = ['Track ID', + 'Name', + 'Description', + 'Room', + 'Start Date', + 'End Date', + 'Submitter Name', + 'Included in Cfp', + 'State'] + tracks_array << header_array + @tracks.confirmed.each do |track| + row = [] + row << track.id + row << track.name.to_s + row << track.description.to_s + row << track.try(:room).try(:name) + row << track.start_date.to_s + row << track.end_date.to_s + row << track.try(:submitter).try(:name) + row << (track.cfp_active? ? 'Yes' : 'No') + row << track.state + tracks_array << row + end + pdf.text "#{@conference.short_title} tracks", font_size: 25, align: :center + pdf.table tracks_array, header: true, cell_style: {size: 8, border_width: 1},column_widths: [40,70,230,65,55,55,90,65,50] +end diff --git a/app/views/admin/tracks/_confirmed_tracks.xlsx.axlsx b/app/views/admin/tracks/_confirmed_tracks.xlsx.axlsx new file mode 100644 index 00000000..673b985c --- /dev/null +++ b/app/views/admin/tracks/_confirmed_tracks.xlsx.axlsx @@ -0,0 +1,29 @@ +wb.add_worksheet(name: 'all tracks') do |sheet| + bold_style = wb.styles.add_style(b: true) + wrap_text = wb.styles.add_style alignment: {wrap_text: true} + row = ['Track ID', + 'Name', + 'Description', + 'Room', + 'Start Date', + 'End Date', + 'Submitter Name', + 'Included in Cfp', + 'State'] + sheet.add_row row, style: bold_style + + @tracks.confirmed.each do |track| + row = [] + row << track.id + row << track.name.to_s + row << track.description.to_s + row << track.try(:room).try(:name) + row << track.start_date.to_s + row << track.end_date.to_s + row << track.try(:submitter).try(:name) + row << (track.cfp_active? ? 'Yes' : 'No') + row << track.state + sheet.add_row row , style: wrap_text + sheet.column_widths 10,20,50,20,12,12,20,15,10 + end +end diff --git a/app/views/admin/tracks/index.html.haml b/app/views/admin/tracks/index.html.haml index b814ac8e..a5f5c9a0 100644 --- a/app/views/admin/tracks/index.html.haml +++ b/app/views/admin/tracks/index.html.haml @@ -2,7 +2,32 @@ .row .col-md-12 .page-header - %h1 Tracks + %h1 + Tracks + .pull-right + - if can? :read, Track + .btn-group + .btn-group + %button.btn.btn-default.dropdown-toggle{ 'data-toggle' => 'dropdown', type: 'button', class: 'btn btn-success' } + Export PDF + %span.caret + %ul.dropdown-menu{ role: 'menu' } + %li= link_to 'All Tracks', admin_conference_program_tracks_path(@conference.short_title, format: :pdf, track_export_option: 'all') + %li= link_to 'Confirmed Tracks', admin_conference_program_tracks_path(@conference.short_title, format: :pdf, track_export_option: 'confirmed') + .btn-group + %button.btn.btn-default.dropdown-toggle{ 'data-toggle' => 'dropdown', type: 'button', class: 'btn btn-success' } + Export CSV + %span.caret + %ul.dropdown-menu{ role: 'menu' } + %li= link_to 'All', admin_conference_program_tracks_path(@conference.short_title, format: :csv, track_export_option: 'all') + %li= link_to 'Confirmed', admin_conference_program_tracks_path(@conference.short_title, format: :csv, track_export_option: 'confirmed') + .btn-group + %button.btn.btn-default.dropdown-toggle{ 'data-toggle' => 'dropdown', type: 'button', class: 'btn btn-success' } + Export XLS + %span.caret + %ul.dropdown-menu{ role: 'menu' } + %li= link_to 'All', admin_conference_program_tracks_path(@conference.short_title, format: :xlsx, track_export_option: 'all') + %li= link_to 'Confirmed', admin_conference_program_tracks_path(@conference.short_title, format: :xlsx, track_export_option: 'confirmed') %p.text-muted Categorize events in your conference .row diff --git a/app/views/admin/tracks/tracks.csv.haml b/app/views/admin/tracks/tracks.csv.haml new file mode 100644 index 00000000..a94811fe --- /dev/null +++ b/app/views/admin/tracks/tracks.csv.haml @@ -0,0 +1,4 @@ +- if @track_export_option == 'confirmed' + = render 'confirmed_tracks' +- elsif @track_export_option == 'all' + = render 'all_tracks' diff --git a/app/views/admin/tracks/tracks.pdf.prawn b/app/views/admin/tracks/tracks.pdf.prawn new file mode 100644 index 00000000..c74b3cbb --- /dev/null +++ b/app/views/admin/tracks/tracks.pdf.prawn @@ -0,0 +1,5 @@ +if @track_export_option == 'confirmed' + render 'confirmed_tracks' +elsif @track_export_option == 'all' + render 'all_tracks' +end diff --git a/app/views/admin/tracks/tracks.xlsx.axlsx b/app/views/admin/tracks/tracks.xlsx.axlsx new file mode 100644 index 00000000..6a84da9b --- /dev/null +++ b/app/views/admin/tracks/tracks.xlsx.axlsx @@ -0,0 +1,6 @@ +wb = xlsx_package.workbook +if @track_export_option == 'confirmed' + render partial: 'confirmed_tracks', locals: { wb: wb } +elsif @track_export_option == 'all' + render partial: 'all_tracks', locals: { wb: wb } +end From 7c0fa59a0a37d6950496ac1dc16906bdd51225dc Mon Sep 17 00:00:00 2001 From: Your Name <01namangupta@gmail.com> Date: Thu, 12 Oct 2017 23:51:58 +0530 Subject: [PATCH 20/35] Speaker emails in Events CSV/XLS export is included --- app/models/event.rb | 9 +++++++++ app/views/admin/events/_all_events.csv.haml | 14 +++++++++++--- app/views/admin/events/_all_events.xlsx.axlsx | 14 +++++++++++++- .../admin/events/_all_with_comments.csv.haml | 16 +++++++++++++--- .../admin/events/_all_with_comments.xlsx.axlsx | 17 +++++++++++++++-- .../admin/events/_confirmed_events.csv.haml | 14 +++++++++++--- .../admin/events/_confirmed_events.xlsx.axlsx | 14 +++++++++++++- 7 files changed, 85 insertions(+), 13 deletions(-) diff --git a/app/models/event.rb b/app/models/event.rb index c6de2d45..52c6f106 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -211,6 +211,15 @@ class Event < ActiveRecord::Base result.to_a.to_sentence end + # Returns emails of all the speaker belongs to a particular event + def speaker_emails + result = Array.new + speakers.each do |speaker| + result << speaker.email + end + result.to_sentence + end + ## # # Returns +Hash+ diff --git a/app/views/admin/events/_all_events.csv.haml b/app/views/admin/events/_all_events.csv.haml index 9423c4ee..c7bff3be 100644 --- a/app/views/admin/events/_all_events.csv.haml +++ b/app/views/admin/events/_all_events.csv.haml @@ -4,6 +4,7 @@ 'Start time', 'Submitter', 'Speaker', + 'Speaker Email', 'Event Type', 'Track', 'Difficulty Level', @@ -12,8 +13,15 @@ = CSV.generate_line ['All Events'] = CSV.generate_line headers - @events.each do |event| - = CSV.generate_line([event.id, event.title, event.abstract, (event.time.present? ? "#{event.time.strftime("%Y-%m-%d")} #{event.time.strftime("%I:%M%p")} " : ''), - event.submitter.name, event.speaker_names, event.event_type.title, + = CSV.generate_line([event.id, + event.title, + event.abstract, + (event.time.present? ? "#{event.time.strftime("%Y-%m-%d")}#{event.time.strftime("%I:%M%p")} " : ''), + event.submitter.name, + event.speaker_names, + event.speaker_emails, + event.event_type.title, (event.track.present? ? event.track.name : ''), (event.difficulty_level.present? ? event.difficulty_level.title : ''), - (event.room.present? ? event.room.name : ''), event.state]).html_safe + (event.room.present? ? event.room.name : ''), + event.state]).html_safe diff --git a/app/views/admin/events/_all_events.xlsx.axlsx b/app/views/admin/events/_all_events.xlsx.axlsx index 66232784..2391e6dc 100644 --- a/app/views/admin/events/_all_events.xlsx.axlsx +++ b/app/views/admin/events/_all_events.xlsx.axlsx @@ -1,6 +1,17 @@ wb.add_worksheet(name: 'all events') do |sheet| bold_style = wb.styles.add_style(b: true) - row = ['Event ID', 'Title', 'Abstract', 'Start time', 'Submitter', 'Speaker', 'Event Type', 'Track', 'Difficulty Level', 'Room', 'State'] + row = ['Event ID', + 'Title', + 'Abstract', + 'Start time', + 'Submitter', + 'Speaker', + 'Speaker Email', + 'Event Type', + 'Track', + 'Difficulty Level', + 'Room', + 'State'] sheet.add_row row, style: bold_style @events.each do |event| @@ -11,6 +22,7 @@ wb.add_worksheet(name: 'all events') do |sheet| row << (event.time.present? ? "#{event.time.strftime("%Y-%m-%d")} #{event.time.strftime("%I:%M%p")} " : '') row << event.submitter.name row << event.speaker_names + row << event.speaker_emails row << event.event_type.title row << (event.track.present? ? event.track.name : '') row << (event.difficulty_level.present? ? event.difficulty_level.title : '') diff --git a/app/views/admin/events/_all_with_comments.csv.haml b/app/views/admin/events/_all_with_comments.csv.haml index cdf79339..315da41e 100644 --- a/app/views/admin/events/_all_with_comments.csv.haml +++ b/app/views/admin/events/_all_with_comments.csv.haml @@ -4,6 +4,7 @@ 'Start time', 'Submitter', 'Speaker', + 'Speaker Email', 'Event Type', 'Track', 'Difficulty Level', @@ -16,8 +17,17 @@ - all_comments = '' - event.root_comments.each do |comment| - all_comments << "#{comment.created_at.strftime("%Y-%m-%d")} #{comment.created_at.strftime("%I:%M%p")} #{comment.user.name}: #{comment.body}\n" - = CSV.generate_line([event.id, event.title, event.abstract, (event.time.present? ? "#{event.time.strftime("%Y-%m-%d")} #{event.time.strftime("%I:%M%p")} " : ''), - event.submitter.name, event.speaker_names, event.event_type.title, + = CSV.generate_line([event.id, + event.title, + event.abstract, + (event.time.present? ? "#{event.time.strftime("%Y-%m-%d")}#{event.time.strftime("%I:%M%p")} " : ''), + event.submitter.name, + event.speaker_names, + event.speaker_emails, + event.event_type.title, (event.track.present? ? event.track.name : ''), (event.difficulty_level.present? ? event.difficulty_level.title : ''), - (event.room.present? ? event.room.name : ''), event.state, all_comments]).html_safe + (event.room.present? ? event.room.name : ''), + event.state, + all_comments]).html_safe + diff --git a/app/views/admin/events/_all_with_comments.xlsx.axlsx b/app/views/admin/events/_all_with_comments.xlsx.axlsx index 038dfea5..9a9e8c71 100644 --- a/app/views/admin/events/_all_with_comments.xlsx.axlsx +++ b/app/views/admin/events/_all_with_comments.xlsx.axlsx @@ -1,8 +1,20 @@ wb.use_shared_strings = true wb.add_worksheet(name: 'events with comments') do |sheet| - bold_style = wb.styles.add_style(b: true ) + bold_style = wb.styles.add_style( b: true ) cell_style = wb.styles.add_style(alignment: { wrap_text: true, vertical: :top }) -row = ['Event ID', 'Title', 'Abstract', 'Start time', 'Submitter', 'Speaker', 'Event Type', 'Track', 'Difficulty Level', 'Room', 'State', 'Comments'] + row = ['Event ID', + 'Title', + 'Abstract', + 'Start time', + 'Submitter', + 'Speaker', + 'Speaker Email', + 'Event Type', + 'Track', + 'Difficulty Level', + 'Room', + 'State', + 'Comments'] sheet.add_row row, style: bold_style @events.each do |event| @@ -17,6 +29,7 @@ row = ['Event ID', 'Title', 'Abstract', 'Start time', 'Submitter', 'Speaker', 'E row << (event.time.present? ? "#{event.time.strftime("%Y-%m-%d")} #{event.time.strftime("%I:%M%p")} " : '') row << event.submitter.name row << event.speaker_names + row << event.speaker_emails row << event.event_type.title row << (event.track.present? ? event.track.name : '') row << (event.difficulty_level.present? ? event.difficulty_level.title : '') diff --git a/app/views/admin/events/_confirmed_events.csv.haml b/app/views/admin/events/_confirmed_events.csv.haml index 4edbbaa3..2a61c352 100644 --- a/app/views/admin/events/_confirmed_events.csv.haml +++ b/app/views/admin/events/_confirmed_events.csv.haml @@ -4,6 +4,7 @@ 'Start time', 'Submitter', 'Speaker', + 'Speaker Email', 'Event Type', 'Track', 'Difficulty Level', @@ -12,8 +13,15 @@ = CSV.generate_line ["Confirmed Events"] = CSV.generate_line headers - @events.confirmed.each do |event| - = CSV.generate_line([event.id, event.title, event.abstract, (event.time.present? ? "#{event.time.strftime("%Y-%m-%d")} #{event.time.strftime("%I:%M%p")} " : ''), - event.submitter.name, event.speaker_names, event.event_type.title, + = CSV.generate_line([event.id, + event.title, + event.abstract, + (event.time.present? ? "#{event.time.strftime("%Y-%m-%d")} #{event.time.strftime("%I:%M%p")} " : ''), + event.submitter.name, + event.speaker_names, + event.speaker_emails, + event.event_type.title, (event.track.present? ? event.track.name : ''), (event.difficulty_level.present? ? event.difficulty_level.title : ''), - (event.room.present? ? event.room.name : ''), event.state]).html_safe + (event.room.present? ? event.room.name : ''), + event.state]).html_safe diff --git a/app/views/admin/events/_confirmed_events.xlsx.axlsx b/app/views/admin/events/_confirmed_events.xlsx.axlsx index 34c40b36..3d1067f6 100644 --- a/app/views/admin/events/_confirmed_events.xlsx.axlsx +++ b/app/views/admin/events/_confirmed_events.xlsx.axlsx @@ -1,6 +1,17 @@ wb.add_worksheet(name: 'confirmed events') do |sheet| bold_style = wb.styles.add_style(b: true) - row = ['Event ID', 'Title', 'Abstract', 'Start time', 'Submitter', 'Speaker', 'Event Type', 'Track', 'Difficulty Level', 'Room', 'State'] + row = ['Event ID', + 'Title', + 'Abstract', + 'Start time', + 'Submitter', + 'Speaker', + 'Speaker Email', + 'Event Type', + 'Track', + 'Difficulty Level', + 'Room', + 'State'] sheet.add_row row, style: bold_style @events.confirmed.each do |event| @@ -11,6 +22,7 @@ wb.add_worksheet(name: 'confirmed events') do |sheet| row << (event.time.present? ? "#{event.time.strftime("%Y-%m-%d")} #{event.time.strftime("%I:%M%p")} " : '') row << event.submitter.name row << event.speaker_names + row << event.speaker_emails row << event.event_type.title row << (event.track.present? ? event.track.name : '') row << (event.difficulty_level.present? ? event.difficulty_level.title : '') From 5b7aa56f6b2b7a3046615a85194a9d9aff4b653f Mon Sep 17 00:00:00 2001 From: Your Name <01namangupta@gmail.com> Date: Fri, 13 Oct 2017 16:08:33 +0530 Subject: [PATCH 21/35] minor changes --- app/models/event.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/event.rb b/app/models/event.rb index 52c6f106..472130e3 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -213,7 +213,7 @@ class Event < ActiveRecord::Base # Returns emails of all the speaker belongs to a particular event def speaker_emails - result = Array.new + result = [] speakers.each do |speaker| result << speaker.email end From 52a5cb2391739155ca0f176f25f5a5d9e5e2e546 Mon Sep 17 00:00:00 2001 From: Your Name <01namangupta@gmail.com> Date: Fri, 13 Oct 2017 23:33:43 +0530 Subject: [PATCH 22/35] speakers email field is added to pdf --- app/models/event.rb | 6 +----- app/views/admin/events/_all_events.pdf.prawn | 2 ++ app/views/admin/events/_all_with_comments.pdf.prawn | 2 ++ app/views/admin/events/_all_with_comments.xlsx.axlsx | 2 +- app/views/admin/events/_confirmed_events.pdf.prawn | 2 ++ 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/models/event.rb b/app/models/event.rb index 472130e3..2d18db1e 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -213,11 +213,7 @@ class Event < ActiveRecord::Base # Returns emails of all the speaker belongs to a particular event def speaker_emails - result = [] - speakers.each do |speaker| - result << speaker.email - end - result.to_sentence + speakers.map(&:email).join(', ') end ## diff --git a/app/views/admin/events/_all_events.pdf.prawn b/app/views/admin/events/_all_events.pdf.prawn index e53a1018..f13d4a8e 100644 --- a/app/views/admin/events/_all_events.pdf.prawn +++ b/app/views/admin/events/_all_events.pdf.prawn @@ -6,6 +6,7 @@ prawn_document(force_download: true, filename: "#{@file_name}.pdf", page_layout: 'Start time', 'Submitter', 'Speaker', + 'Speaker Email', 'Event Type', 'Track', 'Difficulty Level', @@ -21,6 +22,7 @@ prawn_document(force_download: true, filename: "#{@file_name}.pdf", page_layout: row << (event.time.present? ? "#{event.time.strftime("%Y-%m-%d")} #{event.time.strftime("%I:%M%p")} " : '') row << event.submitter.name row << event.speaker_names + row << event.speaker_emails row << event.event_type.title row << (event.track.present? ? event.track.name : '') row << (event.difficulty_level.present? ? event.difficulty_level.title : '') diff --git a/app/views/admin/events/_all_with_comments.pdf.prawn b/app/views/admin/events/_all_with_comments.pdf.prawn index 2df27759..2a93fe5d 100644 --- a/app/views/admin/events/_all_with_comments.pdf.prawn +++ b/app/views/admin/events/_all_with_comments.pdf.prawn @@ -6,6 +6,7 @@ prawn_document(force_download: true, filename: "#{@file_name}.pdf", page_layout: 'Start time', 'Submitter', 'Speaker', + 'Speaker Email', 'Event Type', 'Track', 'Difficulty Level', @@ -21,6 +22,7 @@ prawn_document(force_download: true, filename: "#{@file_name}.pdf", page_layout: row << (event.time.present? ? "#{event.time.strftime("%Y-%m-%d")} #{event.time.strftime("%I:%M%p")} " : '') row << event.submitter.name row << event.speaker_names + row << event.speaker_emails row << event.event_type.title row << (event.track.present? ? event.track.name : '') row << (event.difficulty_level.present? ? event.difficulty_level.title : '') diff --git a/app/views/admin/events/_all_with_comments.xlsx.axlsx b/app/views/admin/events/_all_with_comments.xlsx.axlsx index 9a9e8c71..430c131d 100644 --- a/app/views/admin/events/_all_with_comments.xlsx.axlsx +++ b/app/views/admin/events/_all_with_comments.xlsx.axlsx @@ -1,6 +1,6 @@ wb.use_shared_strings = true wb.add_worksheet(name: 'events with comments') do |sheet| - bold_style = wb.styles.add_style( b: true ) + bold_style = wb.styles.add_style(b: true) cell_style = wb.styles.add_style(alignment: { wrap_text: true, vertical: :top }) row = ['Event ID', 'Title', diff --git a/app/views/admin/events/_confirmed_events.pdf.prawn b/app/views/admin/events/_confirmed_events.pdf.prawn index ea838b94..621a5384 100644 --- a/app/views/admin/events/_confirmed_events.pdf.prawn +++ b/app/views/admin/events/_confirmed_events.pdf.prawn @@ -6,6 +6,7 @@ prawn_document(force_download: true, filename: "#{@file_name}.pdf", page_layout: 'Start time', 'Submitter', 'Speaker', + 'Speaker Email', 'Event Type', 'Track', 'Difficulty Level', @@ -21,6 +22,7 @@ prawn_document(force_download: true, filename: "#{@file_name}.pdf", page_layout: row << (event.time.present? ? "#{event.time.strftime("%Y-%m-%d")} #{event.time.strftime("%I:%M%p")} " : '') row << event.submitter.name row << event.speaker_names + row << event.speaker_emails row << event.event_type.title row << (event.track.present? ? event.track.name : '') row << (event.difficulty_level.present? ? event.difficulty_level.title : '') From 6c8ebe586c0312aadc99c97fc626dcded73e4e85 Mon Sep 17 00:00:00 2001 From: Your Name <01namangupta@gmail.com> Date: Tue, 17 Oct 2017 20:54:53 +0530 Subject: [PATCH 23/35] speakers_names is made in sentense using join --- app/models/event.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/app/models/event.rb b/app/models/event.rb index 2d18db1e..360421f5 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -204,11 +204,7 @@ class Event < ActiveRecord::Base end def speaker_names - result = Set.new - speakers.each do |speaker| - result.add(speaker.name) - end - result.to_a.to_sentence + speakers.map(&:name).join(', ') end # Returns emails of all the speaker belongs to a particular event From 2e07462d776cfe05ce41c6484dfe70167b87f040 Mon Sep 17 00:00:00 2001 From: Naman Gupta <01namangupta@gmail.com> Date: Wed, 8 Nov 2017 00:49:03 +0530 Subject: [PATCH 24/35] exports are made to be wrap_text --- app/views/admin/events/_all_events.pdf.prawn | 2 +- app/views/admin/events/_all_events.xlsx.axlsx | 4 +++- app/views/admin/events/_all_with_comments.pdf.prawn | 2 +- app/views/admin/events/_all_with_comments.xlsx.axlsx | 1 + app/views/admin/events/_confirmed_events.pdf.prawn | 2 +- app/views/admin/events/_confirmed_events.xlsx.axlsx | 4 +++- 6 files changed, 10 insertions(+), 5 deletions(-) diff --git a/app/views/admin/events/_all_events.pdf.prawn b/app/views/admin/events/_all_events.pdf.prawn index f13d4a8e..3f1c0d78 100644 --- a/app/views/admin/events/_all_events.pdf.prawn +++ b/app/views/admin/events/_all_events.pdf.prawn @@ -32,5 +32,5 @@ prawn_document(force_download: true, filename: "#{@file_name}.pdf", page_layout: end pdf.text "#{@conference.short_title} Events", font_size: 25, align: :center - pdf.table events_array, header: true, cell_style: {size: 8, border_width: 1} + pdf.table events_array, header: true, cell_style: {size: 8, border_width: 1},column_widths: [40,60,90,50,70,65,85,50,55,50,60,45] end diff --git a/app/views/admin/events/_all_events.xlsx.axlsx b/app/views/admin/events/_all_events.xlsx.axlsx index 2391e6dc..3197cf38 100644 --- a/app/views/admin/events/_all_events.xlsx.axlsx +++ b/app/views/admin/events/_all_events.xlsx.axlsx @@ -1,5 +1,6 @@ wb.add_worksheet(name: 'all events') do |sheet| bold_style = wb.styles.add_style(b: true) + wrap_text = wb.styles.add_style alignment: {wrap_text: true} row = ['Event ID', 'Title', 'Abstract', @@ -28,6 +29,7 @@ wb.add_worksheet(name: 'all events') do |sheet| row << (event.difficulty_level.present? ? event.difficulty_level.title : '') row << (event.room.present? ? event.room.name : '') row << event.state - sheet.add_row row + sheet.add_row row , style: wrap_text + sheet.column_widths 10,15,35,13,18,18,28,12,15,15,15,10 end end diff --git a/app/views/admin/events/_all_with_comments.pdf.prawn b/app/views/admin/events/_all_with_comments.pdf.prawn index 2a93fe5d..ccc9b773 100644 --- a/app/views/admin/events/_all_with_comments.pdf.prawn +++ b/app/views/admin/events/_all_with_comments.pdf.prawn @@ -33,7 +33,7 @@ prawn_document(force_download: true, filename: "#{@file_name}.pdf", page_layout: pdf.text "#{@conference.short_title} Events", font_size: 25, align: :center pdf.move_down 10 - pdf.table events_array, header: true, cell_style: {size: 8, border_width: 1, position: :center} + pdf.table events_array, header: true, cell_style: {size: 8, border_width: 1, position: :center},column_widths: [40,60,90,50,70,65,85,50,55,50,60,45] pdf.start_new_page pdf.text "#{@conference.short_title} Comments", font_size: 25, align: :center pdf.move_down 20 diff --git a/app/views/admin/events/_all_with_comments.xlsx.axlsx b/app/views/admin/events/_all_with_comments.xlsx.axlsx index 430c131d..fd798ca5 100644 --- a/app/views/admin/events/_all_with_comments.xlsx.axlsx +++ b/app/views/admin/events/_all_with_comments.xlsx.axlsx @@ -37,5 +37,6 @@ wb.add_worksheet(name: 'events with comments') do |sheet| row << event.state row << all_comments.strip sheet.add_row row, style: cell_style + sheet.column_widths 10,15,35,13,18,18,28,12,15,15,15,10 end end diff --git a/app/views/admin/events/_confirmed_events.pdf.prawn b/app/views/admin/events/_confirmed_events.pdf.prawn index 621a5384..8bef8883 100644 --- a/app/views/admin/events/_confirmed_events.pdf.prawn +++ b/app/views/admin/events/_confirmed_events.pdf.prawn @@ -32,6 +32,6 @@ prawn_document(force_download: true, filename: "#{@file_name}.pdf", page_layout: end pdf.text "#{@conference.short_title} Confirmed Events", font_size: 25, align: :center - pdf.table events_array, header: true, cell_style: {size: 8, border_width: 1} + pdf.table events_array, header: true, cell_style: {size: 8, border_width: 1},column_widths: [40,60,90,50,70,65,85,50,55,50,60,45] end diff --git a/app/views/admin/events/_confirmed_events.xlsx.axlsx b/app/views/admin/events/_confirmed_events.xlsx.axlsx index 3d1067f6..a1c8c886 100644 --- a/app/views/admin/events/_confirmed_events.xlsx.axlsx +++ b/app/views/admin/events/_confirmed_events.xlsx.axlsx @@ -1,5 +1,6 @@ wb.add_worksheet(name: 'confirmed events') do |sheet| bold_style = wb.styles.add_style(b: true) + wrap_text = wb.styles.add_style alignment: {wrap_text: true} row = ['Event ID', 'Title', 'Abstract', @@ -28,6 +29,7 @@ wb.add_worksheet(name: 'confirmed events') do |sheet| row << (event.difficulty_level.present? ? event.difficulty_level.title : '') row << (event.room.present? ? event.room.name : '') row << event.state - sheet.add_row row + sheet.add_row row , style: wrap_text + sheet.column_widths 10,15,35,13,18,18,28,12,15,15,15,10 end end From 94de2e813c2f91888e0ec81c5ffe279b5034220a Mon Sep 17 00:00:00 2001 From: Naman Gupta <01namangupta@gmail.com> Date: Wed, 8 Nov 2017 01:41:42 +0530 Subject: [PATCH 25/35] test is fixed --- spec/models/event_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/models/event_spec.rb b/spec/models/event_spec.rb index 0a84aedd..158e1db3 100644 --- a/spec/models/event_spec.rb +++ b/spec/models/event_spec.rb @@ -362,7 +362,7 @@ describe Event do new_event.submitter = submitter new_event.speakers = [speaker1, speaker2] - expect(new_event.speaker_names).to eq 'user speaker 1 and user speaker 2' + expect(new_event.speaker_names).to eq 'user speaker 1, user speaker 2' end end end From 1b8f864febb9e6f39099cdfbc0a8c8fef89ee6a8 Mon Sep 17 00:00:00 2001 From: James Mason Date: Tue, 7 Nov 2017 13:51:10 -0800 Subject: [PATCH 26/35] Use organization name for title link if available, but link to / --- app/helpers/application_helper.rb | 14 ++++++++++++++ app/views/layouts/_navigation.html.haml | 6 ++---- spec/features/splashpage_spec.rb | 14 +++++++++----- spec/helpers/application_helper_spec.rb | 16 ++++++++++++++++ 4 files changed, 41 insertions(+), 9 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 6174500e..f77d7963 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -171,4 +171,18 @@ module ApplicationHelper def hidden_if_conference_over(conference) 'hidden' if Date.today > conference.end_date end + + def nav_root_link_for(conference) + link_text = ( + conference.try(:organization).try(:name) || + ENV['OSEM_NAME'] || + 'OSEM' + ) + link_to( + link_text, + root_path, + class: 'navbar-brand', + title: 'Open Source Event Manager' + ) + end end diff --git a/app/views/layouts/_navigation.html.haml b/app/views/layouts/_navigation.html.haml index 9995123b..f7d5fa30 100644 --- a/app/views/layouts/_navigation.html.haml +++ b/app/views/layouts/_navigation.html.haml @@ -13,10 +13,8 @@ %span.icon-bar %span.icon-bar %span.icon-bar - - if conference.nil? || conference.new_record? - = link_to (ENV['OSEM_NAME'] || 'OSEM'), root_path, class: 'navbar-brand', title: 'Open Source Event Manager' - - else - = link_to conference.organization.name, organizations_path, class: 'navbar-brand', title: 'Open Source Event Manager' + = nav_root_link_for conference + .collapse.navbar-collapse#main-nav - if content_for :splash_nav %ul.nav.navbar-nav#splash-nav diff --git a/spec/features/splashpage_spec.rb b/spec/features/splashpage_spec.rb index ee9b63d5..d33c6c85 100644 --- a/spec/features/splashpage_spec.rb +++ b/spec/features/splashpage_spec.rb @@ -62,14 +62,18 @@ feature Splashpage do end end - context 'public splashpage already created' do + context 'navigation' do let!(:splashpage) { create(:splashpage, conference: conference, public: true)} - scenario 'should have organization name', feature: true, js: true do - sign_in participant - visit conference_path(conference.short_title) + context 'multiple organizations' do + let!(:additional_organization) { create(:organization) } - expect(page).to have_text(conference.organization.name) + scenario 'should have organization name', feature: true, js: true do + sign_in participant + visit conference_path(conference.short_title) + + expect(page).to have_text(conference.organization.name) + end end end end diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index 139a5cf9..6cd71d2a 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -58,5 +58,21 @@ describe ApplicationHelper, type: :helper do expect(concurrent_events(event).present?).to eq false end end + + describe 'navigation title link' do + it 'should default to OSEM' do + ENV.delete('OSEM_NAME') + expect(nav_root_link_for(nil)).to match 'OSEM' + end + + it 'should use the environment variable' do + ENV['OSEM_NAME'] = Faker::Company.name + expect(nav_root_link_for(nil)).to match ENV['OSEM_NAME'] + end + + it 'should use the conference organization name' do + expect(nav_root_link_for(conference)).to match conference.organization.name + end + end end end From 714f89f6bafc6d979c1b3356337a03e82625ff1d Mon Sep 17 00:00:00 2001 From: James Mason Date: Wed, 11 Oct 2017 20:22:32 -0700 Subject: [PATCH 27/35] Fix missing link on public organizations page When viewing a conference, the Instance Name in the header points to /organizations. On the organizations index, there's a button to see conferences, but it does nothing. This makes it easy for public users to get lost. This commit: * Adds a function to the organizations controller to show child conferences * Adds a public permission to see conferences through an organization * Represents a subset of conferences, reusing conferences/index view, for the organization --- app/controllers/organizations_controller.rb | 6 +++ app/models/ability.rb | 2 +- app/views/conferences/index.html.haml | 4 +- app/views/organizations/index.html.haml | 4 +- config/routes.rb | 6 ++- .../organizations_controller_spec.rb | 43 +++++++++++++++++++ spec/features/organization_spec.rb | 8 ++++ 7 files changed, 68 insertions(+), 5 deletions(-) diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 3d549dfa..2ebbdeeb 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -4,4 +4,10 @@ class OrganizationsController < ApplicationController def index @organizations = Organization.all end + + def conferences + @current = @organization.conferences.upcoming.reorder(start_date: :asc) + @antiquated = @organization.conferences.past + render '/conferences/index' + end end diff --git a/app/models/ability.rb b/app/models/ability.rb index 18f9d4c4..b833b6f4 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -15,7 +15,7 @@ class Ability # Abilities for not signed in users (guests) def not_signed_in - can [:index], Organization + can [:index, :conferences], Organization can [:index], Conference can [:show], Conference do |conference| conference.splashpage && conference.splashpage.public == true diff --git a/app/views/conferences/index.html.haml b/app/views/conferences/index.html.haml index 032db5c3..a3735478 100644 --- a/app/views/conferences/index.html.haml +++ b/app/views/conferences/index.html.haml @@ -4,7 +4,7 @@ .page-header %h2 Upcoming Conferences - @current.each do |conference| - = render partial: 'conference_details', locals: { conference: conference } + = render '/conferences/conference_details', conference: conference -if @antiquated and @antiquated.any? .row .col-md-12 @@ -17,7 +17,7 @@ %i.fa.fa-chevron-down{ style: 'display: none' } #antiquated.collapse - @antiquated.each do |conference| - = render partial: 'conference_details', locals: { conference: conference} + = render '/conferences/conference_details', conference: conference -content_for :script_body do :javascript diff --git a/app/views/organizations/index.html.haml b/app/views/organizations/index.html.haml index b2794bd8..bc5a4d5e 100644 --- a/app/views/organizations/index.html.haml +++ b/app/views/organizations/index.html.haml @@ -12,5 +12,7 @@ .caption %h4 = organization.name - %button.btn.btn-success Conferences + = link_to 'Conferences', + conferences_organization_path(organization), + class: 'btn btn-success' / = link_to 'Edit', edit_organization_path(organization), class: 'btn btn-mini btn-default' diff --git a/config/routes.rb b/config/routes.rb index 6e8a66de..33a92a48 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -149,7 +149,11 @@ Osem::Application.routes.draw do get '/revision_history/:id/revert_object' => 'versions#revert_object', as: 'revision_history_revert_object' get '/revision_history/:id/revert_attribute' => 'versions#revert_attribute', as: 'revision_history_revert_attribute' end - resources :organizations, only: [:index] + resources :organizations, only: [:index] do + member do + get :conferences + end + end resources :conferences, only: [:index, :show] do resources :booths do member do diff --git a/spec/controllers/organizations_controller_spec.rb b/spec/controllers/organizations_controller_spec.rb index 2916fdea..eb0109a1 100644 --- a/spec/controllers/organizations_controller_spec.rb +++ b/spec/controllers/organizations_controller_spec.rb @@ -2,6 +2,26 @@ require 'spec_helper' describe OrganizationsController do let!(:organization) { create(:organization) } + let!(:conference) do + create( + :conference, + splashpage: create(:splashpage, public: true), + venue: create(:venue), + organization: organization + ) + end + let!(:antiquated_conference) do + create( + :conference, + splashpage: create(:splashpage, public: true), + venue: create(:venue), + organization: organization, + start_date: 2.weeks.ago, + end_date: 1.week.ago + ) + end + + let!(:other_conference) { create(:conference) } let!(:user) { create(:user) } describe 'GET #index' do @@ -12,4 +32,27 @@ describe OrganizationsController do it { expect(response).to render_template('index') } end + + describe 'GET #conferences' do + before :each do + get :conferences, id: organization.id + end + + it 'loads the organization' do + expect(assigns(:organization)).to eq organization + end + + it 'includes organization conferences' do + expect(assigns(:current)).to include conference + end + + it 'does not include conferences outside organization' do + expect(assigns(:current)).not_to include other_conference + expect(assigns(:antiquated)).not_to include other_conference + end + + it 'includes antiquated organization conferences' do + expect(assigns(:antiquated)).to include antiquated_conference + end + end end diff --git a/spec/features/organization_spec.rb b/spec/features/organization_spec.rb index 6fcf590b..72948c2d 100644 --- a/spec/features/organization_spec.rb +++ b/spec/features/organization_spec.rb @@ -48,4 +48,12 @@ feature Organization do it_behaves_like 'successfully updates an organization' end + + context 'anonymously' do + scenario 'index should link to conferences list' do + visit organizations_path + + expect(page).to have_link('Conferences', href: "/organizations/#{organization.id}/conferences") + end + end end From 90edc648f877c3cdb0a9654469ec86cf6843bc5b Mon Sep 17 00:00:00 2001 From: Naman Gupta <01namangupta@gmail.com> Date: Thu, 9 Nov 2017 01:40:56 +0530 Subject: [PATCH 28/35] programs.speakers is fixed --- app/models/program.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/program.rb b/app/models/program.rb index 612d8154..03e5725a 100644 --- a/app/models/program.rb +++ b/app/models/program.rb @@ -42,7 +42,8 @@ class Program < ActiveRecord::Base has_many :event_schedules, through: :events has_many :event_users, through: :events - has_many :speakers, -> { distinct }, through: :event_users, source: :user do + has_many :program_events_speakers, -> {where(event_role: 'speaker')},through: :events, source: :event_users + has_many :speakers, -> { distinct }, through: :program_events_speakers, source: :user do def confirmed joins(:events).where(events: { state: :confirmed }) end From ada0f814a7d9bd5f05b58c35b3bae9fcc7c397ff Mon Sep 17 00:00:00 2001 From: Naman Gupta <01namangupta@gmail.com> Date: Thu, 9 Nov 2017 02:00:49 +0530 Subject: [PATCH 29/35] linting error is fixed --- app/models/program.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/program.rb b/app/models/program.rb index 03e5725a..addda157 100644 --- a/app/models/program.rb +++ b/app/models/program.rb @@ -42,7 +42,7 @@ class Program < ActiveRecord::Base has_many :event_schedules, through: :events has_many :event_users, through: :events - has_many :program_events_speakers, -> {where(event_role: 'speaker')},through: :events, source: :event_users + has_many :program_events_speakers, -> {where(event_role: 'speaker')}, through: :events, source: :event_users has_many :speakers, -> { distinct }, through: :program_events_speakers, source: :user do def confirmed joins(:events).where(events: { state: :confirmed }) From d0dbb7d29e4cd0d1165a7f72210c5f283b08f45c Mon Sep 17 00:00:00 2001 From: Naman Gupta <01namangupta@gmail.com> Date: Thu, 9 Nov 2017 02:39:41 +0530 Subject: [PATCH 30/35] tests are fixed --- spec/models/program_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/models/program_spec.rb b/spec/models/program_spec.rb index 1c8eabd9..62e576f4 100644 --- a/spec/models/program_spec.rb +++ b/spec/models/program_spec.rb @@ -15,8 +15,8 @@ describe Program do it { is_expected.to have_many(:events).dependent(:destroy) } it { is_expected.to have_many(:event_schedules).through(:events) } it { is_expected.to have_many(:event_users).through(:events) } - it { is_expected.to have_many(:speakers).through(:event_users).source(:user) } - + it { is_expected.to have_many(:program_events_speakers).through(:events).source(:event_users) } + it { is_expected.to have_many(:speakers).through(:program_events_speakers).source(:user) } it { is_expected.to accept_nested_attributes_for(:event_types) } it { is_expected.to accept_nested_attributes_for(:tracks) } it { is_expected.to accept_nested_attributes_for(:difficulty_levels) } From 6fa709a4de497a52100d14b458a975a4fe7ca645 Mon Sep 17 00:00:00 2001 From: Adriano Vieira Date: Sun, 12 Nov 2017 01:55:03 -0200 Subject: [PATCH 31/35] Fix to only show speaker email if it's public --- app/views/proposals/show.html.haml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/proposals/show.html.haml b/app/views/proposals/show.html.haml index c181e283..19f9371f 100644 --- a/app/views/proposals/show.html.haml +++ b/app/views/proposals/show.html.haml @@ -36,7 +36,8 @@ .col-md-8 %h4 = link_to speaker.name, user_path(speaker.id) - = "(#{speaker.email})" + - if speaker.email_public? + = "(#{speaker.email})" - if speaker.affiliation? .text-muted from From fba12aef24ff3388bb44a29df63e9e3496f8eb0a Mon Sep 17 00:00:00 2001 From: James Mason Date: Sun, 12 Nov 2017 20:43:02 -0800 Subject: [PATCH 32/35] Only include transifex JS if the ENV var is set ... otherwise, don't bother loading this blocking external resource. --- app/views/layouts/application.html.haml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index c1a6ce78..ee88a24c 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -9,15 +9,16 @@ = javascript_include_tag "application" = csrf_meta_tags - :javascript - window.liveSettings = { - api_key: "#{ENV['OSEM_TRANSIFEX_APIKEY']}", - picker: "bottom-right", - detectlang: true, - autocollect: true - }; = content_for(:script_head) - = javascript_include_tag "//cdn.transifex.com/live.js" + - if ENV['OSEM_TRANSIFEX_APIKEY'] + :javascript + window.liveSettings = { + api_key: "#{ENV['OSEM_TRANSIFEX_APIKEY']}", + picker: "bottom-right", + detectlang: true, + autocollect: true + }; + = javascript_include_tag "//cdn.transifex.com/live.js" = yield(:head) %body From bd045c2976156502a456fcb06904e4cbcbae75b1 Mon Sep 17 00:00:00 2001 From: ViditChitkara Date: Tue, 5 Sep 2017 18:15:46 +0530 Subject: [PATCH 33/35] added description field to cfps closes #1650 done some changes minor changes added markdown format to cfp#show fixed description text position in proposals fixed truncated description text in show action minor changes on non-admin side --- app/controllers/admin/cfps_controller.rb | 2 +- app/views/admin/cfps/_booths_cfp.html.haml | 6 +++++- app/views/admin/cfps/_events_cfp.html.haml | 4 ++++ app/views/admin/cfps/_form.html.haml | 1 + app/views/admin/cfps/_tracks_cfp.html.haml | 4 ++++ app/views/admin/cfps/index.html.haml | 4 ++++ app/views/proposals/index.html.haml | 8 ++++++++ app/views/proposals/new.html.haml | 5 +++++ db/migrate/20170905110034_add_description_to_cfps.rb | 5 +++++ db/schema.rb | 5 +++-- spec/factories/cfps.rb | 2 +- 11 files changed, 41 insertions(+), 5 deletions(-) create mode 100644 db/migrate/20170905110034_add_description_to_cfps.rb diff --git a/app/controllers/admin/cfps_controller.rb b/app/controllers/admin/cfps_controller.rb index da2723b7..18b493eb 100644 --- a/app/controllers/admin/cfps_controller.rb +++ b/app/controllers/admin/cfps_controller.rb @@ -55,7 +55,7 @@ module Admin private def cfp_params - params.require(:cfp).permit(:start_date, :end_date, :cfp_type) + params.require(:cfp).permit(:start_date, :end_date, :description, :cfp_type) end end end diff --git a/app/views/admin/cfps/_booths_cfp.html.haml b/app/views/admin/cfps/_booths_cfp.html.haml index 7cdc6db4..2b82f813 100644 --- a/app/views/admin/cfps/_booths_cfp.html.haml +++ b/app/views/admin/cfps/_booths_cfp.html.haml @@ -11,6 +11,10 @@ %dd = @cfp.end_date.strftime('%A, %B %e. %Y') %dt - Days Left: + Description +%dd + = markdown(@cfp.description) +%dt + Days Left %dd = pluralize(@cfp.remaining_days, 'day') diff --git a/app/views/admin/cfps/_events_cfp.html.haml b/app/views/admin/cfps/_events_cfp.html.haml index f06aa6ca..f4557bb4 100644 --- a/app/views/admin/cfps/_events_cfp.html.haml +++ b/app/views/admin/cfps/_events_cfp.html.haml @@ -10,6 +10,10 @@ End Date: %dd#end_date = @cfp.end_date.strftime('%A, %B %-d. %Y') +%dt + Description: +%dd#description + = markdown(@cfp.description) %dt Days Left: %dd diff --git a/app/views/admin/cfps/_form.html.haml b/app/views/admin/cfps/_form.html.haml index a02f3a02..b42a76e1 100644 --- a/app/views/admin/cfps/_form.html.haml +++ b/app/views/admin/cfps/_form.html.haml @@ -8,5 +8,6 @@ = f.input :start_date, as: :string, input_html: { id: 'registration-period-start-datepicker', start_date: @conference.start_date, end_date: @conference.end_date, readonly: 'readonly' } = f.input :end_date, as: :string, input_html: { id: 'registration-period-end-datepicker', readonly: 'readonly' } = f.input :cfp_type, as: :select, collection: (@cfp.new_record? ? @program.remaining_cfp_types : [@cfp.cfp_type] + @program.remaining_cfp_types).map {|type| ["#{type.capitalize}", type]}, include_blank: false, label: 'Type', input_html: { class: 'select-help-toggle' } + = f.input :description, input_html: {rows: 2, data: { provide: 'markdown-editable' } }, hint: markdown_hint %p.text-right = f.action :submit, as: :button, button_html: { class: 'btn btn-primary' } diff --git a/app/views/admin/cfps/_tracks_cfp.html.haml b/app/views/admin/cfps/_tracks_cfp.html.haml index bcc2df43..20926758 100644 --- a/app/views/admin/cfps/_tracks_cfp.html.haml +++ b/app/views/admin/cfps/_tracks_cfp.html.haml @@ -10,6 +10,10 @@ End Date: %dd#end_date = @cfp.end_date.strftime('%A, %B %-d. %Y') +%dt + Description: +%dd#description + = markdown(@cfp.description) %dt Days Left: %dd diff --git a/app/views/admin/cfps/index.html.haml b/app/views/admin/cfps/index.html.haml index 0067229c..fb075eae 100644 --- a/app/views/admin/cfps/index.html.haml +++ b/app/views/admin/cfps/index.html.haml @@ -12,6 +12,7 @@ %th Type %th Start Date %th End Date + %th Description %th Days Left %th Actions %tbody @@ -24,6 +25,9 @@ = cfp.start_date.strftime('%A, %B %-d. %Y') %td = cfp.end_date.strftime('%A, %B %-d. %Y') + %td + %p + = markdown(truncate(cfp.description)) %td = pluralize(cfp.remaining_days, 'day') %td diff --git a/app/views/proposals/index.html.haml b/app/views/proposals/index.html.haml index 97a721c0..e40eb30e 100644 --- a/app/views/proposals/index.html.haml +++ b/app/views/proposals/index.html.haml @@ -6,6 +6,14 @@ %span.notranslate = @conference.title + + - if @program.cfp_open? + - if @program.cfp.description.present? + .row + .col-md-12 + = markdown(@program.cfp.description) + + .row .col-md-12 = render partial: 'encouragement_text' diff --git a/app/views/proposals/new.html.haml b/app/views/proposals/new.html.haml index 25a78786..0f699559 100644 --- a/app/views/proposals/new.html.haml +++ b/app/views/proposals/new.html.haml @@ -3,6 +3,11 @@ .col-md-12 .page-header %h1 New Proposal + - if @program.cfp_open? + - if @program.cfp.description.present? + .row + .col-md-12 + = markdown(@program.cfp.description) .row .col-md-12 = render partial: 'encouragement_text' diff --git a/db/migrate/20170905110034_add_description_to_cfps.rb b/db/migrate/20170905110034_add_description_to_cfps.rb new file mode 100644 index 00000000..a4976ee2 --- /dev/null +++ b/db/migrate/20170905110034_add_description_to_cfps.rb @@ -0,0 +1,5 @@ +class AddDescriptionToCfps < ActiveRecord::Migration + def change + add_column :cfps, :description, :text + end +end diff --git a/db/schema.rb b/db/schema.rb index 6c6531c1..bdf3ad65 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -68,12 +68,13 @@ ActiveRecord::Schema.define(version: 20170924190528) do end create_table "cfps", force: :cascade do |t| - t.date "start_date", null: false - t.date "end_date", null: false + t.date "start_date", null: false + t.date "end_date", null: false t.datetime "created_at" t.datetime "updated_at" t.integer "program_id" t.string "cfp_type" + t.text "description" end create_table "comments", force: :cascade do |t| diff --git a/spec/factories/cfps.rb b/spec/factories/cfps.rb index 6b061d53..ea59a8c1 100644 --- a/spec/factories/cfps.rb +++ b/spec/factories/cfps.rb @@ -5,7 +5,7 @@ FactoryGirl.define do start_date { 1.day.ago } end_date { 2.days.from_now } cfp_type 'events' - + description 'This is a test description' program end end From 837d8ec0db282d3c7ef0b3011ab2fc75b3b8d69b Mon Sep 17 00:00:00 2001 From: rahul Date: Tue, 17 Oct 2017 20:01:15 +0530 Subject: [PATCH 34/35] Add popup confirmation on update button Popup is added so user can confirm the changes Closes https://github.com/openSUSE/osem/issues/1687 --- app/views/admin/conferences/edit.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admin/conferences/edit.html.haml b/app/views/admin/conferences/edit.html.haml index 26ae198f..b14fd7bb 100644 --- a/app/views/admin/conferences/edit.html.haml +++ b/app/views/admin/conferences/edit.html.haml @@ -29,4 +29,4 @@ = f.inputs name: 'Booths' do = f.input :booth_limit, as: :number, in: 0..9999, hint: 'Booth limit is the maximum number of booths that you can accept for this conference. By setting this number (0 no limit) you can be sure that you are not going to accept more booths than the conference can accommodate. You currently have ' + pluralize(@conference.booths.accepted.count, 'accepted booth') +'.' - = f.action :submit, as: :button, button_html: {class: 'btn btn-primary'} + = f.action :submit, as: :button, button_html: { class: 'btn btn-primary', data: { confirm: 'Are you sure you want to proceed?' } } From 4785293bf1348549ade1c68ef35f613eaa509a6f Mon Sep 17 00:00:00 2001 From: rahul Date: Sat, 11 Nov 2017 00:54:31 +0530 Subject: [PATCH 35/35] Add hint in start and end hour in conference#edit --- app/controllers/admin/conferences_controller.rb | 1 + app/helpers/application_helper.rb | 6 ++++++ app/views/admin/conferences/edit.html.haml | 4 ++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/controllers/admin/conferences_controller.rb b/app/controllers/admin/conferences_controller.rb index d8c101d1..8f8f2959 100644 --- a/app/controllers/admin/conferences_controller.rb +++ b/app/controllers/admin/conferences_controller.rb @@ -193,6 +193,7 @@ module Admin def edit @conferences = Conference.all @date_string = date_string(@conference.start_date, @conference.end_date) + @affected_event_count = @conference.program.events.scheduled(@conference.program.selected_schedule_id).count respond_to do |format| format.html format.json { render json: @conference.to_json } diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index f77d7963..b5e2892e 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -163,6 +163,12 @@ module ApplicationHelper end end + def rescheduling_hint(affected_event_count) + if affected_event_count > 0 + "You have #{affected_event_count} scheduled #{'event'.pluralize(affected_event_count)}. Changing the conference hours will unschedule those scheduled outside the conference hours." + end + end + ## # ====Gets # a conference object diff --git a/app/views/admin/conferences/edit.html.haml b/app/views/admin/conferences/edit.html.haml index b14fd7bb..ac90610d 100644 --- a/app/views/admin/conferences/edit.html.haml +++ b/app/views/admin/conferences/edit.html.haml @@ -22,8 +22,8 @@ = f.input :timezone, as: :time_zone, hint: 'The conference time zone' = f.input :start_date, as: :string, input_html: { id: 'conference-start-datepicker', readonly: 'readonly' } = f.input :end_date, as: :string, input_html: { id: 'conference-end-datepicker', readonly: 'readonly' } - = f.input :start_hour, input_html: {size: 2, type: 'number', min: 0, max: 23} - = f.input :end_hour, input_html: {size: 2, type: 'number', min: 1, max: 24} + = f.input :start_hour, input_html: {size: 2, type: 'number', min: 0, max: 23}, hint: rescheduling_hint(@affected_event_count) + = f.input :end_hour, input_html: {size: 2, type: 'number', min: 1, max: 24}, hint: rescheduling_hint(@affected_event_count) = f.inputs name: 'Registrations' do = f.input :registration_limit, as: :number, in: 0..9999, hint: 'Limit the number of registrations to the conference (0 no limit). Please note that the registration limit doesn\'t apply to speakers of confirmed events (they will still be able to register even if it has been reached). You currently have ' + pluralize(@conference.registrations.count, 'registration') = f.inputs name: 'Booths' do