diff --git a/Gemfile b/Gemfile index 6bd5e90..28cf3aa 100644 --- a/Gemfile +++ b/Gemfile @@ -40,8 +40,8 @@ gem 'haml_assets' gem 'handlebars_assets' gem 'i18n-js' gem 'i18n-active_record', - :git => 'git://github.com/svenfuchs/i18n-active_record.git', - :require => 'i18n/active_record' + :git => 'git://github.com/svenfuchs/i18n-active_record.git', + :require => 'i18n/active_record' gem 'jquery-turbolinks' gem 'sass-rails', '~> 4.0.0' gem "compass-rails", "~> 1.1.3" @@ -55,48 +55,48 @@ gem 'redis' gem 'carrierwave' gem 'carrierwave-imageoptimizer' gem 'mini_magick' -gem 'carmen-rails', '~> 1.0.0', github: 'jim/carmen-rails' +#gem 'carmen-rails'#, '~> 1.0.0', github: 'jim/carmen-rails' gem 'nested_form' gem 'acts_as_list' -#gem 'jcrop-rails' -#gem 'rmagick' +##gem 'jcrop-rails' +##gem 'rmagick' gem 'geocoder' gem 'forgery' gem 'paper_trail' group :development, :test do - gem 'debugger' - gem 'delorean' - gem 'factory_girl_rails' - gem 'faker' - gem 'pry' - gem 'pry-rails' + gem 'debugger' + gem 'delorean' + gem 'factory_girl_rails' + #gem 'faker' + gem 'pry' + gem 'pry-rails' end group :development do - #gem 'perftools.rb' - gem 'bullet' - gem 'better_errors' - gem 'binding_of_caller' - gem 'meta_request' - gem 'haml-rails' - gem 'awesome_print' + #gem 'perftools.rb' + gem 'bullet' + gem 'better_errors' + gem 'binding_of_caller' + gem 'meta_request' + gem 'haml-rails' + gem 'awesome_print' end group :test do - gem 'capybara' - gem 'coveralls', require: false - gem 'database_cleaner' - gem 'email_spec' - gem 'launchy' - gem 'rspec' - gem 'rspec-rails' - gem 'selenium-webdriver' - gem 'simplecov', require: false - gem 'webmock', require: false + gem 'capybara' + gem 'coveralls', require: false + gem 'database_cleaner' + gem 'email_spec' + gem 'launchy' + gem 'rspec' + gem 'rspec-rails' + gem 'selenium-webdriver' + gem 'simplecov', require: false + gem 'webmock', require: false end group :staging, :production do - gem 'rails_12factor' + gem 'rails_12factor' end diff --git a/Gemfile.lock b/Gemfile.lock index ac4e465..86ef600 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,11 +1,3 @@ -GIT - remote: git://github.com/jim/carmen-rails.git - revision: 076dd251e075d07408e0b5268f886956ef2a347c - specs: - carmen-rails (1.0.0) - carmen (~> 1.0.0) - rails - GIT remote: git://github.com/svenfuchs/i18n-active_record.git revision: 55507cf59f8f2173d38e07e18df0e90d25b1f0f6 @@ -65,8 +57,6 @@ GEM rack (>= 1.0.0) rack-test (>= 0.5.4) xpath (~> 2.0) - carmen (1.0.0) - unicode_utils (~> 1.4.0) carrierwave (0.9.0) activemodel (>= 3.2.0) activesupport (>= 3.2.0) @@ -118,7 +108,6 @@ GEM launchy (~> 2.1) mail (~> 2.2) erubis (2.7.0) - eventmachine (1.0.3) eventmachine (1.0.3-x86-mingw32) execjs (2.0.2) factory_girl (4.4.0) @@ -126,8 +115,6 @@ GEM factory_girl_rails (4.4.0) factory_girl (~> 4.4.0) railties (>= 3.0.0) - faker (1.2.0) - i18n (~> 0.5) faraday (0.9.0) multipart-post (>= 1.2, < 3) ffi (1.9.3-x86-mingw32) @@ -187,8 +174,6 @@ GEM multi_json (1.8.4) multipart-post (2.0.0) nested_form (0.3.2) - nokogiri (1.6.1) - mini_portile (~> 0.5.0) nokogiri (1.6.1-x86-mingw32) mini_portile (~> 0.5.0) oauth (0.4.7) @@ -203,10 +188,6 @@ GEM activesupport (>= 3.0, < 5.0) pg (0.17.1-x86-mingw32) polyglot (0.3.3) - pry (0.9.12.6) - coderay (~> 1.0) - method_source (~> 0.8) - slop (~> 3.4) pry (0.9.12.6-x86-mingw32) coderay (~> 1.0) method_source (~> 0.8) @@ -310,7 +291,6 @@ GEM uglifier (2.4.0) execjs (>= 0.3.0) json (>= 1.8.0) - unicode_utils (1.4.0) uniform_notifier (1.4.0) webmock (1.17.3) addressable (>= 2.2.7) @@ -330,7 +310,6 @@ DEPENDENCIES binding_of_caller bullet capybara - carmen-rails (~> 1.0.0)! carrierwave carrierwave-imageoptimizer coffee-rails (~> 4.0.0) @@ -341,7 +320,6 @@ DEPENDENCIES delorean email_spec factory_girl_rails - faker forgery foundation-rails geocoder diff --git a/app/controllers/conferences_controller.rb b/app/controllers/conferences_controller.rb index d5b577a..028daa3 100644 --- a/app/controllers/conferences_controller.rb +++ b/app/controllers/conferences_controller.rb @@ -125,6 +125,12 @@ class ConferencesController < ApplicationController set_conference end + def workshops + set_conference + @workshops = Workshop.where(:conference_id => @conference.id) + render 'workshops/index' + end + # DELETE /conferences/1 def destroy @conference.destroy @@ -134,7 +140,7 @@ class ConferencesController < ApplicationController private # Use callbacks to share common setup or constraints between actions. def set_conference - @conference = Conference.find_by(slug: params[:slug] || params[:conference_slug]) + @conference = Conference.find_by(slug: params[:conference_slug] || params[:slug]) set_conference_registration end diff --git a/app/controllers/workshops_controller.rb b/app/controllers/workshops_controller.rb index 853cbe3..ef4611d 100644 --- a/app/controllers/workshops_controller.rb +++ b/app/controllers/workshops_controller.rb @@ -1,58 +1,69 @@ class WorkshopsController < ApplicationController - before_action :set_workshop, only: [:show, :edit, :update, :destroy] - - # GET /workshops - def index - @workshops = Workshop.all - end - - # GET /workshops/1 - def show - end - - # GET /workshops/new - def new - @workshop = Workshop.new - end - - # GET /workshops/1/edit - def edit - end - - # POST /workshops - def create - @workshop = Workshop.new(workshop_params) - - if @workshop.save - redirect_to @workshop, notice: 'Workshop was successfully created.' - else - render action: 'new' - end - end - - # PATCH/PUT /workshops/1 - def update - if @workshop.update(workshop_params) - redirect_to @workshop, notice: 'Workshop was successfully updated.' - else - render action: 'edit' - end - end - - # DELETE /workshops/1 - def destroy - @workshop.destroy - redirect_to workshops_url, notice: 'Workshop was successfully destroyed.' - end - - private - # Use callbacks to share common setup or constraints between actions. - def set_workshop - @workshop = Workshop.find(params[:id]) - end - - # Only allow a trusted parameter "white list" through. - def workshop_params - params.require(:workshop).permit(:title, :slug, :info, :conference_id, :workshop_stream_id, :workshop_presentation_style, :min_facilitators, :location_id, :start_time, :end_time) - end + before_action :set_workshop, only: [:show, :edit, :update, :destroy] + + # GET /workshops + def index + set_conference + @workshops = Workshop.where(['conference_id = ?', @conference.id]) + end + + # GET /workshops/1 + def show + set_workshop + set_conference + end + + # GET /workshops/new + def new + set_conference + @workshop = Workshop.new + end + + # GET /workshops/1/edit + def edit + set_conference + end + + # POST /workshops + def create + set_conference + @workshop = Workshop.new(workshop_params) + + if @workshop.save + redirect_to conference_workshop_path(@conference, @workshop), notice: 'Workshop was successfully created.' + else + render action: 'new' + end + end + + # PATCH/PUT /workshops/1 + def update + set_conference + if @workshop.update(workshop_params) + redirect_to conference_workshop_path(@conference, @workshop), notice: 'Workshop was successfully updated.' + else + render action: 'edit' + end + end + + # DELETE /workshops/1 + def destroy + @workshop.destroy + redirect_to workshops_url, notice: 'Workshop was successfully destroyed.' + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_workshop + @workshop = Workshop.find_by(slug: params[:workshop_slug] || params[:slug]) + end + + def set_conference + @conference = Conference.find_by(slug: params[:conference_slug] || params[:slug]) + end + + # Only allow a trusted parameter "white list" through. + def workshop_params + params.require(:workshop).permit(:title, :slug, :info, :conference_id, :workshop_stream_id, :workshop_presentation_style, :min_facilitators, :location_id, :start_time, :end_time) + end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 38dcf23..08fcbe0 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -406,7 +406,18 @@ module ApplicationHelper if params[:action] == tab.to_s c << 'current' end - tab_list += link_to tab, link || object, :class => c + link_html = '' + if tab.is_a?(Hash) + func = tab.keys[0] + val = tab[func] + args = val ? (val.is_a?(Array) ? (val.collect { |v| object[v] } ) : [object[val]] ) : nil + + link_html = link_to func.to_s.gsub(/_path$/, ''), args ? self.send(func, args) : self.send(func), :class => c + else + #x + link_html = link_to tab, link || object, :class => c + end + tab_list += link_html end ('