From fb42458999dad28ae70d87de0309bfc67138f8d2 Mon Sep 17 00:00:00 2001 From: Willem van Kerkhof Date: Mon, 13 Aug 2018 18:17:18 +0200 Subject: [PATCH 1/7] Refinery 4.0.0 compatibility --- Rakefile | 2 +- .../calendar/admin/events_controller.rb | 3 +- .../refinery/calendar/events_controller.rb | 23 +++++--- app/models/refinery/calendar/event.rb | 17 ++---- app/models/refinery/calendar/venue.rb | 2 +- config/routes.rb | 36 ++++++------ db/seeds.rb | 55 +++++++++---------- lib/generators/refinery/calendar_generator.rb | 2 +- lib/refinery/calendar.rb | 40 ++++++++++++++ lib/refinery/calendar/configuration.rb | 39 +++++++++++++ lib/refinery/{events => calendar}/engine.rb | 14 ++--- lib/refinery/calendar/tabs.rb | 22 ++++++++ lib/refinery/events.rb | 22 -------- lib/refinery/venues.rb | 21 ------- lib/refinery/venues/engine.rb | 14 ----- lib/refinerycms-calendar.rb | 3 +- lib/tasks/refinery/calendar.rake | 13 ----- refinerycms-calendar.gemspec | 10 ++-- 18 files changed, 183 insertions(+), 155 deletions(-) create mode 100644 lib/refinery/calendar.rb create mode 100644 lib/refinery/calendar/configuration.rb rename lib/refinery/{events => calendar}/engine.rb (68%) create mode 100644 lib/refinery/calendar/tabs.rb delete mode 100644 lib/refinery/events.rb delete mode 100644 lib/refinery/venues.rb delete mode 100644 lib/refinery/venues/engine.rb delete mode 100644 lib/tasks/refinery/calendar.rake diff --git a/Rakefile b/Rakefile index 022bde3..30b03df 100644 --- a/Rakefile +++ b/Rakefile @@ -17,4 +17,4 @@ Refinery::Testing::Railtie.load_dummy_tasks(ENGINE_PATH) load File.expand_path('../tasks/rspec.rake', __FILE__) -task :default => :spec \ No newline at end of file +task :default => :spec diff --git a/app/controllers/refinery/calendar/admin/events_controller.rb b/app/controllers/refinery/calendar/admin/events_controller.rb index 0604fcd..ed352d1 100644 --- a/app/controllers/refinery/calendar/admin/events_controller.rb +++ b/app/controllers/refinery/calendar/admin/events_controller.rb @@ -7,7 +7,8 @@ class EventsController < ::Refinery::AdminController crudify :'refinery/calendar/event', sortable: false, - order: "starts_at DESC" + order: 'starts_at DESC' + protected diff --git a/app/controllers/refinery/calendar/events_controller.rb b/app/controllers/refinery/calendar/events_controller.rb index 9d84278..d16328b 100644 --- a/app/controllers/refinery/calendar/events_controller.rb +++ b/app/controllers/refinery/calendar/events_controller.rb @@ -1,30 +1,37 @@ +require 'responders' + module Refinery module Calendar class EventsController < ::ApplicationController before_action :find_page, except: :archive + respond_to :html + def index - @events = Event.upcoming.order('refinery_calendar_events.starts_at DESC') + @events = Event.upcoming.order(starts_at: :desc) - # you can use meta fields from your model instead (e.g. browser_title) - # by swapping @page for @event in the line below: - present(@page) + respond_with (@events) do |format| + format.html +# format.rss { render layout: false } + end end def show @event = Event.friendly.find(params[:id]) - # you can use meta fields from your model instead (e.g. browser_title) - # by swapping @page for @event in the line below: - present(@page) + respond_with (@event) do |format| + format.html { present(@event) } +# format.js { render partial: 'post', layout: false } + end end def archive - @events = Event.archive.order('refinery_calendar_events.starts_at DESC') + @events = Event.archive.order(starts_at: :desc) render :template => 'refinery/calendar/events/index' end protected + def find_page @page = ::Refinery::Page.where(:link_url => "/calendar/events").first end diff --git a/app/models/refinery/calendar/event.rb b/app/models/refinery/calendar/event.rb index 1b4d606..3d695b0 100644 --- a/app/models/refinery/calendar/event.rb +++ b/app/models/refinery/calendar/event.rb @@ -1,6 +1,6 @@ module Refinery module Calendar - class Event < Refinery::Core::BaseModel + class Event < ActiveRecord::Base extend FriendlyId friendly_id :title, :use => :slugged @@ -28,20 +28,11 @@ class Event < Refinery::Core::BaseModel ) } - class << self - def upcoming - where('refinery_calendar_events.starts_at >= ?', Time.now) - end + scope :upcoming, -> { where arel_table[:starts_at].gteq Time.now } - def featured - where(:featured => true) - end + scope :featured, -> { where featured: true } - def archive - where('refinery_calendar_events.starts_at < ?', Time.now) - end - - end + scope :archive, -> { where arel_table[:starts_at].lt Time.now } end end end diff --git a/app/models/refinery/calendar/venue.rb b/app/models/refinery/calendar/venue.rb index bdaa1c6..dc5e457 100644 --- a/app/models/refinery/calendar/venue.rb +++ b/app/models/refinery/calendar/venue.rb @@ -1,6 +1,6 @@ module Refinery module Calendar - class Venue < Refinery::Core::BaseModel + class Venue < ActiveRecord::Base has_many :events validates :name, :presence => true, :uniqueness => true end diff --git a/config/routes.rb b/config/routes.rb index a4d7020..37dc51a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,28 +1,30 @@ -Refinery::Core::Engine.routes.append do +Refinery::Core::Engine.routes.draw do + namespace :calendar, :path => Refinery::Calendar.page_url do + root :to => 'events#index' - # Frontend routes - namespace :calendar do get 'events/archive' => 'events#archive' + resources :events, :only => [:index, :show] + + resources :venues, :only => [:index, :show] end - # Admin routes + namespace :calendar, :path => '' do - namespace :admin, :path => 'refinery/calendar' do - resources :events, :except => :show do - collection do - post :update_positions + namespace :admin, :path => Refinery::Core.backend_route do + scope :path => Refinery::Calendar.page_url do + root :to => 'events#index' + + resources :events, except: :show do + collection do + post :update_positions + end end - end - end - end - # Admin routes - namespace :calendar, :path => '' do - namespace :admin, :path => 'refinery/calendar' do - resources :venues, :except => :show do - collection do - post :update_positions + resources :venues, except: :show do + collection do + post :update_positions + end end end end diff --git a/db/seeds.rb b/db/seeds.rb index 80abf5c..c76e126 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -1,36 +1,35 @@ -if defined?(::Refinery::User) - ::Refinery::User.all.each do |user| - if user.plugins.where(:name => 'refinery_calendar').blank? - user.plugins.create(:name => 'refinery_calendar', - :position => (user.plugins.maximum(:position) || -1) +1) - end +Refinery::User.all.each do |user| + if user.plugins.where(:name => 'refinerycms_calendar').blank? + user.plugins.create(:name => "refinerycms_calendar", + :position => (user.plugins.maximum(:position) || -1) +1) end -end +end if defined?(Refinery::User) +if defined?(::Refinery::Page) + url = "/calendar/venues" + if ::Refinery::Page.where(:link_url => url).empty? + page = ::Refinery::Page.create \ + :title => 'Venues', + :link_url => url, + :deletable => false, + :menu_match => "^#{url}(\/|\/.+?|)$" -url = "/calendar/venues" -if defined?(::Refinery::Page) && ::Refinery::Page.where(:link_url => url).empty? - page = ::Refinery::Page.create( - :title => 'Venues', - :link_url => url, - :deletable => false, - :menu_match => "^#{url}(\/|\/.+?|)$" - ) - Refinery::Pages.default_parts.each_with_index do |default_page_part, index| - page.parts.create(:title => default_page_part, :body => nil, :position => index) + Refinery::Pages.default_parts.each_with_index do |default_page_part, index| + page.parts.create(:title => default_page_part, :body => nil, :position => index) + end end -end -url = "/calendar/events" -if defined?(::Refinery::Page) && ::Refinery::Page.where(:link_url => url).empty? - page = ::Refinery::Page.create( - :title => 'Events', - :link_url => url, - :deletable => false, - :menu_match => "^#{url}(\/|\/.+?|)$" - ) - Refinery::Pages.default_parts.each_with_index do |default_page_part, index| - page.parts.create(:title => default_page_part, :body => nil, :position => index) + url = "/calendar/events" + if ::Refinery::Page.where(:link_url => url).empty? + page = ::Refinery::Page.create \ + :title => 'Events', + :link_url => url, + :deletable => false, + :menu_match => "^#{url}(\/|\/.+?|)$" + + Refinery::Pages.default_parts.each_with_index do |default_page_part, index| + page.parts.create(:title => default_page_part, :body => nil, :position => index) + end end end diff --git a/lib/generators/refinery/calendar_generator.rb b/lib/generators/refinery/calendar_generator.rb index 9883c28..3aff1a1 100644 --- a/lib/generators/refinery/calendar_generator.rb +++ b/lib/generators/refinery/calendar_generator.rb @@ -2,7 +2,7 @@ module Refinery class CalendarGenerator < Rails::Generators::Base def rake_db - rake("refinery_calendar:install:migrations") + rake 'refinery_calendar:install:migrations' end def append_load_seed_data diff --git a/lib/refinery/calendar.rb b/lib/refinery/calendar.rb new file mode 100644 index 0000000..6964417 --- /dev/null +++ b/lib/refinery/calendar.rb @@ -0,0 +1,40 @@ +require 'refinerycms-core' +require 'refinerycms-settings' +require 'rails_autolink' +require 'friendly_id' +require 'jquery-ui-rails' +require 'globalize' +require 'seo_meta' + +module Refinery + autoload :CalendarGenerator, 'generators/refinery/calendar/calendar_generator' + + module Calendar + require 'refinery/calendar/engine' + require 'refinery/calendar/configuration' + + autoload :Version, 'refinery/calendar/version' + autoload :Tab, 'refinery/calendar/tabs' + + class << self + attr_writer :root + attr_writer :tabs + + def root + @root ||= Pathname.new(File.expand_path('../../../', __FILE__)) + end + + def tabs + @tabs ||= [] + end + + def version + ::Refinery::Calendar::Version.to_s + end + + def factory_paths + @factory_paths ||= [ root.join("spec/factories").to_s ] + end + end + end +end diff --git a/lib/refinery/calendar/configuration.rb b/lib/refinery/calendar/configuration.rb new file mode 100644 index 0000000..e61f15d --- /dev/null +++ b/lib/refinery/calendar/configuration.rb @@ -0,0 +1,39 @@ +module Refinery + module Calendar + include ActiveSupport::Configurable + + config_accessor :page_url +# :validate_source_url, :comments_per_page, :posts_per_page, +# :post_teaser_length, :share_this_key, +# +# self.validate_source_url = false +# self.comments_per_page = 10 +# self.posts_per_page = 10 +# self.post_teaser_length = 250 +# self.share_this_key = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" + self.page_url = '/calendar' + + # Refinery::User isn't available when this line gets hit, so we use static methods instead + @@user_class_name = nil + class << self + def user_class=(class_name) + if class_name.is_a?(Class) + raise TypeError, "You can't set user_class to be a class, e.g., User. Instead, please use a string like 'User'" + elsif class_name.is_a?(String) + @@user_class_name = class_name + else + raise TypeError, "Invalid type for user_class. Please use a string like 'User'" + end + end + + def user_class + class_name = @@user_class_name + begin + Object.const_get(class_name) if class_name.present? + rescue NameError + class_name.constantize + end + end + end + end +end diff --git a/lib/refinery/events/engine.rb b/lib/refinery/calendar/engine.rb similarity index 68% rename from lib/refinery/events/engine.rb rename to lib/refinery/calendar/engine.rb index cb38259..50a75b4 100644 --- a/lib/refinery/events/engine.rb +++ b/lib/refinery/calendar/engine.rb @@ -2,15 +2,14 @@ module Refinery module Calendar class Engine < Rails::Engine include Refinery::Engine - isolate_namespace Refinery::Calendar - engine_name :refinery_calendar + isolate_namespace Refinery::Calendar before_inclusion do Refinery::Plugin.register do |plugin| - plugin.name = "refinery_calendar" - plugin.url = proc { Refinery::Core::Engine.routes.url_helpers.calendar_admin_events_path } - plugin.pathname = root + plugin.pathname = root + plugin.name = 'refinery_calendar' + plugin.url = proc { Refinery::Core::Engine.routes.url_helpers.calendar_admin_events_path } plugin.menu_match = %r{refinery/calendar(/.*)?$} end @@ -22,13 +21,12 @@ class Engine < Rails::Engine chosen.css jquery-ui.css refinery/calendar.css - ) end config.after_initialize do - Refinery.register_extension(Refinery::Events) + Refinery.register_extension(Refinery::Calendar) end end end -end \ No newline at end of file +end diff --git a/lib/refinery/calendar/tabs.rb b/lib/refinery/calendar/tabs.rb new file mode 100644 index 0000000..2f623d9 --- /dev/null +++ b/lib/refinery/calendar/tabs.rb @@ -0,0 +1,22 @@ +module Refinery + module Calendar + class Tab + attr_accessor :name, :partial + + def self.register(&block) + tab = self.new + + yield tab + + raise "A tab MUST have a name!: #{tab.inspect}" if tab.name.blank? + raise "A tab MUST have a partial!: #{tab.inspect}" if tab.partial.blank? + end + + protected + + def initialize + ::Refinery::Calendar.tabs << self # add me to the collection of registered page tabs + end + end + end +end diff --git a/lib/refinery/events.rb b/lib/refinery/events.rb deleted file mode 100644 index f30b57c..0000000 --- a/lib/refinery/events.rb +++ /dev/null @@ -1,22 +0,0 @@ -require 'refinerycms-core' -require 'friendly_id' - -module Refinery - autoload :CalendarGenerator, 'generators/refinery/calendar_generator' - - module Events - require 'refinery/events/engine' - - class << self - attr_writer :root - - def root - @root ||= Pathname.new(File.expand_path('../../../', __FILE__)) - end - - def factory_paths - @factory_paths ||= [ root.join('spec', 'factories').to_s ] - end - end - end -end diff --git a/lib/refinery/venues.rb b/lib/refinery/venues.rb deleted file mode 100644 index 8c798da..0000000 --- a/lib/refinery/venues.rb +++ /dev/null @@ -1,21 +0,0 @@ -require 'refinerycms-core' - -module Refinery - autoload :CalendarGenerator, 'generators/refinery/calendar_generator' - - module Venues - require 'refinery/venues/engine' - - class << self - attr_writer :root - - def root - @root ||= Pathname.new(File.expand_path('../../../', __FILE__)) - end - - def factory_paths - @factory_paths ||= [ root.join('spec', 'factories').to_s ] - end - end - end -end diff --git a/lib/refinery/venues/engine.rb b/lib/refinery/venues/engine.rb deleted file mode 100644 index fab92a7..0000000 --- a/lib/refinery/venues/engine.rb +++ /dev/null @@ -1,14 +0,0 @@ -module Refinery - module Calendar - class Engine < Rails::Engine - include Refinery::Engine - isolate_namespace Refinery::Calendar - - engine_name :refinery_calendar - - config.after_initialize do - Refinery.register_extension(Refinery::Venues) - end - end - end -end diff --git a/lib/refinerycms-calendar.rb b/lib/refinerycms-calendar.rb index 9da80ea..efe5df0 100644 --- a/lib/refinerycms-calendar.rb +++ b/lib/refinerycms-calendar.rb @@ -1,2 +1 @@ -require 'refinery/events' -require 'refinery/venues' +require 'refinery/calendar' diff --git a/lib/tasks/refinery/calendar.rake b/lib/tasks/refinery/calendar.rake deleted file mode 100644 index e8f164c..0000000 --- a/lib/tasks/refinery/calendar.rake +++ /dev/null @@ -1,13 +0,0 @@ -namespace :refinery do - - namespace :calendar do - - # call this task by running: rake refinery:calendar:my_task - # desc "Description of my task below" - # task :my_task => :environment do - # # add your logic here - # end - - end - -end \ No newline at end of file diff --git a/refinerycms-calendar.gemspec b/refinerycms-calendar.gemspec index 34c6a64..d6c6f82 100644 --- a/refinerycms-calendar.gemspec +++ b/refinerycms-calendar.gemspec @@ -3,15 +3,15 @@ Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.name = 'refinerycms-calendar' - s.version = %q{3.0.0} - s.authors = ['Philip Arndt', 'Joe Sak'] + s.version = %q{4.0.0} + s.authors = ['Philip Arndt', 'Joe Sak', 'Willem van Kerkhof'] s.description = 'Ruby on Rails Calendar extension for Refinery CMS' - s.date = '2012-04-23' + s.date = Time.now s.summary = 'Calendar extension for Refinery CMS' s.require_paths = %w(lib) s.files = Dir["{app,config,db,lib,vendor}/**/*"] + ["readme.md"] # Runtime dependencies - s.add_dependency 'refinerycms-core', '~> 3.0.0' + s.add_dependency 'refinerycms-core', '~> 4.0.0' s.add_dependency 'friendly_id', '~> 5.1.0' -end \ No newline at end of file +end From 573a44b4b2b43f063281c85132f93e27e2c07288 Mon Sep 17 00:00:00 2001 From: Willem van Kerkhof Date: Mon, 13 Aug 2018 18:19:27 +0200 Subject: [PATCH 2/7] Update readme --- readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index 2cff436..a223920 100644 --- a/readme.md +++ b/readme.md @@ -7,7 +7,7 @@ Add this line to your application's `Gemfile` ```ruby -gem 'refinerycms-calendar', '~> 3.0.0' +gem 'refinerycms-calendar', '~> 4.0.0' ``` Next run @@ -19,4 +19,4 @@ rake db:migrate rake db:seed ``` -Now when you start up your Refinery application. \ No newline at end of file +Now when you start up your Refinery application. From db7ccc553fdc7c4f2e61fb38e4b79e1fb591f1ca Mon Sep 17 00:00:00 2001 From: Willem van Kerkhof Date: Mon, 13 Aug 2018 18:22:55 +0200 Subject: [PATCH 3/7] Localize dates --- app/views/refinery/calendar/events/_event.html.erb | 3 ++- app/views/refinery/calendar/events/show.html.erb | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/views/refinery/calendar/events/_event.html.erb b/app/views/refinery/calendar/events/_event.html.erb index 175f8d8..5e66792 100644 --- a/app/views/refinery/calendar/events/_event.html.erb +++ b/app/views/refinery/calendar/events/_event.html.erb @@ -1,8 +1,9 @@ <%= div_for event do -%>

<%= link_to event.title, refinery.calendar_event_path(event) %>

+

<%= event.excerpt %>

<% end -%> diff --git a/app/views/refinery/calendar/events/show.html.erb b/app/views/refinery/calendar/events/show.html.erb index 57449fc..88a3d26 100644 --- a/app/views/refinery/calendar/events/show.html.erb +++ b/app/views/refinery/calendar/events/show.html.erb @@ -6,8 +6,8 @@

<%= t('.details', default: 'Event Details') %>

<%= @event.venue_name %>
-

<%= t('.from', default: 'From') %> <%= @event.from %>
- <%= t('.to', default: 'To') %> <%= @event.to %>

+

<%= t('.from', default: 'From') %> <%= l @event.from %>
+ <%= t('.to', default: 'To') %> <%= l @event.to %>

<% if @event.registration_link.present? %>

<%= link_to t('.register', default: 'Register for this event'), @event.registration_link %>

From 4dff24a76a8016fca1faf6aca5239c8ff80ec90b Mon Sep 17 00:00:00 2001 From: Willem van Kerkhof Date: Mon, 13 Aug 2018 18:33:00 +0200 Subject: [PATCH 4/7] Don't be too specific for friendly_id --- refinerycms-calendar.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/refinerycms-calendar.gemspec b/refinerycms-calendar.gemspec index d6c6f82..c45fe38 100644 --- a/refinerycms-calendar.gemspec +++ b/refinerycms-calendar.gemspec @@ -13,5 +13,5 @@ Gem::Specification.new do |s| # Runtime dependencies s.add_dependency 'refinerycms-core', '~> 4.0.0' - s.add_dependency 'friendly_id', '~> 5.1.0' + s.add_dependency 'friendly_id', '~> 5.1' end From a2a41888106a6faaa6ee9edb50ba9830df727ad2 Mon Sep 17 00:00:00 2001 From: Willem van Kerkhof Date: Mon, 20 Aug 2018 20:20:24 +0200 Subject: [PATCH 5/7] Code cleanup --- .../calendar/admin/events/_actions.html.erb | 29 ++++++++++--------- .../calendar/admin/events/_event.html.erb | 21 +++++--------- .../calendar/admin/events/_form.html.erb | 29 +++++++++---------- .../calendar/admin/events/_records.html.erb | 7 +++-- .../admin/events/_sortable_list.html.erb | 6 ++-- .../calendar/admin/events/index.html.erb | 8 +++-- .../calendar/admin/venues/_actions.html.erb | 3 +- .../calendar/admin/venues/_form.html.erb | 29 +++++++------------ .../calendar/admin/venues/_records.html.erb | 7 +++-- .../admin/venues/_sortable_list.html.erb | 6 ++-- .../calendar/admin/venues/_venue.html.erb | 16 +++++----- .../calendar/admin/venues/index.html.erb | 8 +++-- config/locales/de.yml | 6 ++-- config/locales/en.yml | 2 ++ config/locales/fr.yml | 2 +- 15 files changed, 87 insertions(+), 92 deletions(-) diff --git a/app/views/refinery/calendar/admin/events/_actions.html.erb b/app/views/refinery/calendar/admin/events/_actions.html.erb index 729cbf1..76208a9 100644 --- a/app/views/refinery/calendar/admin/events/_actions.html.erb +++ b/app/views/refinery/calendar/admin/events/_actions.html.erb @@ -4,23 +4,26 @@ <%= render '/refinery/admin/search', :url => refinery.calendar_admin_events_path %> <% end %> +
  • <%= link_to t('.create_new'), refinery.new_calendar_admin_event_path, :class => "add_icon" %>
  • + <%= render 'refinery/calendar/admin/shared/links' %> -<% if !searching? && ::Refinery::Calendar::Admin::EventsController.sortable? && ::Refinery::Calendar::Event.any? %> -
  • - <%= link_to t('.reorder', :what => "Events"), - refinery.calendar_admin_events_path, - :id => "reorder_action", - :class => "reorder_icon" %> - <%= link_to t('.reorder_done', :what => "Events"), - refinery.calendar_admin_events_path, - :id => "reorder_action_done", - :style => "display: none;", - :class => "reorder_icon" %> -
  • -<% end %> + <% if !searching? && ::Refinery::Calendar::Admin::EventsController.sortable? && ::Refinery::Calendar::Event.any? %> +
  • + <%= link_to t('.reorder', :what => "Events"), + refinery.calendar_admin_events_path, + :id => "reorder_action", + :class => "reorder_icon" %> + + <%= link_to t('.reorder_done', :what => "Events"), + refinery.calendar_admin_events_path, + :id => "reorder_action_done", + :style => "display: none;", + :class => "reorder_icon" %> +
  • + <% end %> diff --git a/app/views/refinery/calendar/admin/events/_event.html.erb b/app/views/refinery/calendar/admin/events/_event.html.erb index 962decc..4b2f22d 100644 --- a/app/views/refinery/calendar/admin/events/_event.html.erb +++ b/app/views/refinery/calendar/admin/events/_event.html.erb @@ -1,20 +1,15 @@
  • - + <%= event.title %> - - - <%= link_to refinery_icon_tag("application_go.png"), refinery.calendar_event_path(event), - :title => t('.view_live_html'), - :target => "_blank" %> + + <%= action_icon :preview, refinery.calendar_event_path(event), t('.view_live_html') %> + + <%= action_icon :edit, refinery.edit_calendar_admin_event_path(event), t('.edit') %> - <%= link_to refinery_icon_tag("application_edit.png"), refinery.edit_calendar_admin_event_path(event), - :title => t('.edit') %> - <%= link_to refinery_icon_tag("delete.png"), refinery.calendar_admin_event_path(event), - :class => "cancel confirm-delete", - :title => t('.delete'), - :confirm => t('message', :scope => 'refinery.admin.delete', :title => event.title), - :method => :delete %> + <%= action_icon :delete, refinery.calendar_admin_event_path(event), t('.delete'), + :class => 'cancel confirm-delete', + :confirm => t('refinery.admin.delete.message', :title => event.title) %>
  • diff --git a/app/views/refinery/calendar/admin/events/_form.html.erb b/app/views/refinery/calendar/admin/events/_form.html.erb index 11d8966..aee7d3b 100644 --- a/app/views/refinery/calendar/admin/events/_form.html.erb +++ b/app/views/refinery/calendar/admin/events/_form.html.erb @@ -1,10 +1,7 @@ <%= form_for [refinery, :calendar_admin, @event] do |f| -%> - <%= render '/refinery/admin/error_messages', - :object => @event, - :include_object_name => true %> + <%= render '/refinery/admin/error_messages', :object => @event, :include_object_name => true %> - -
    +
    <%= f.label :title -%> <%= f.text_field :title, :class => 'larger widest' -%>
    @@ -16,32 +13,32 @@

    -
    +
    <%= f.label :from -%> <%= f.date_field :from, :class => 'datetime_range' -%>
    -
    +
    <%= f.label :to -%> <%= f.date_field :to, :class => 'datetime_range' -%>
    -
    +
    <%= f.label :registration_link -%> - <%= f.text_field :registration_link, :class => 'larger' -%> + <%= f.text_field :registration_link, :class => 'larger widest' -%>
    -
    - <%= f.label :venue_id, 'Venue' %> +
    + <%= f.label :venue_id %> <%= f.collection_select :venue_id, @venues, :id, :name, { :include_blank => 'None' }, :class => 'chzn-select', :'data-placeholder' => 'Search Venues', :style => 'width: 300px;' %>
    -
    +
    <%= f.label :excerpt -%> - <%= f.text_area :excerpt, :size => '65x5' -%> + <%= f.text_area :excerpt, :size => '65x5' -%>
    -
    +
      <% [:description].each_with_index do |part, part_index| %> @@ -63,8 +60,8 @@ <%= render '/refinery/admin/form_actions', :f => f, :continue_editing => false, - :delete_title => t('delete', :scope => 'refinery.events.admin.events.event'), - :delete_confirmation => t('message', :scope => 'refinery.admin.delete', :title => @event.title) %> + :delete_title => t('refinery.calendar.admin.events.event.delete'), + :delete_confirmation => t('refinery.admin.delete.message', :title => @event.title) %> <% end -%> <% content_for :stylesheets do %> <%= stylesheet_link_tag 'chosen' %> diff --git a/app/views/refinery/calendar/admin/events/_records.html.erb b/app/views/refinery/calendar/admin/events/_records.html.erb index f6806b4..4272c28 100644 --- a/app/views/refinery/calendar/admin/events/_records.html.erb +++ b/app/views/refinery/calendar/admin/events/_records.html.erb @@ -1,7 +1,8 @@ <% if searching? %> -

      <%= t('results_for', :scope => 'refinery.admin.search', :query => params[:search]) %>

      +

      <%= t('refinery.admin.search.results_for', :query => params[:search]) %>

      <% end %> -
      + +
      <% if @events.any? %> <%= render 'events' %> <% else %> @@ -11,7 +12,7 @@ <%= t('.no_items_yet') %> <% else %> - <%= t('no_results', :scope => 'refinery.admin.search') %> + <%= t('refinery.admin.search.no_results') %> <% end %>

      <% end %> diff --git a/app/views/refinery/calendar/admin/events/_sortable_list.html.erb b/app/views/refinery/calendar/admin/events/_sortable_list.html.erb index 102bd24..406b986 100644 --- a/app/views/refinery/calendar/admin/events/_sortable_list.html.erb +++ b/app/views/refinery/calendar/admin/events/_sortable_list.html.erb @@ -1,5 +1,5 @@ -
        +
          <%= render :partial => 'event', :collection => @events %>
        -<%= render '/refinery/admin/sortable_list', - :continue_reordering => (local_assigns.keys.include?(:continue_reordering)) ? continue_reordering : true %> + +<%= render '/refinery/admin/sortable_list', :continue_reordering => (local_assigns.keys.include?(:continue_reordering)) ? continue_reordering : true %> diff --git a/app/views/refinery/calendar/admin/events/index.html.erb b/app/views/refinery/calendar/admin/events/index.html.erb index 3efbb86..7158527 100644 --- a/app/views/refinery/calendar/admin/events/index.html.erb +++ b/app/views/refinery/calendar/admin/events/index.html.erb @@ -1,8 +1,10 @@ -
        -

        <%= t('title', :scope => 'refinery.plugins.refinery_calendar') %> : <%= t('title', :scope => 'refinery.plugins.events') %>

        +
        +

        <%= t('refinery.plugins.refinery_calendar.title') %>: <%= t('refinery.plugins.events.title') %>

        <%= render 'records' %>
        -