Skip to content

Commit

Permalink
Merge pull request #76 from bricesanchez/master
Browse files Browse the repository at this point in the history
Update engine for refinerycms 3.0.0
  • Loading branch information
unixcharles committed Jul 8, 2015
2 parents c4773e0 + 6d07495 commit ada998a
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
Refinery::Admin::PagesController.class_eval do

# Add :copywriting_phrases_attributes to page_params for strong parameters.
def page_params_with_copywriting_phrases_params
phrases_params = params.require(:page).permit(
copywriting_phrases_attributes: [:id, :value]
)
page_params_without_copywriting_phrases_params.merge(phrases_params)
module RefineryCopywritingControllerDecorator
def permitted_page_params
params[:page][:copywriting_phrases_attributes] ||= {}
super << [copywriting_phrases_attributes: [:id, :value]]
end
alias_method_chain :page_params, :copywriting_phrases_params

end

Refinery::Admin::PagesController.send :prepend, RefineryCopywritingControllerDecorator
21 changes: 12 additions & 9 deletions app/views/refinery/copywriting/admin/phrases/_phrase.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
<% # setup params for various action links
edit_url = refinery.edit_copywriting_admin_phrase_path(phrase, :dialog => true, :switch_locale => @current_locale, :height => 620)
delete_url = refinery.copywriting_admin_phrase_path(phrase)
delete_options = {
class: "cancel confirm-delete",
data: {confirm: t('message', scope: 'refinery.admin.delete', title: phrase.name.capitalize)}
}
%>

<li class='clearfix record <%= cycle("on", "on-hover") %>' id="<%= dom_id(phrase) -%>">
<span class='title'>
<% if @scope.nil? and phrase.scope %>
Expand All @@ -6,15 +15,9 @@
<b><%= phrase.name %></b>
<span class="preview">- <%= truncate(phrase.default_or_value, :length => 40) %></span>
</span>
<span class='actions'>
<%= link_to refinery_icon_tag("application_edit.png"), refinery.edit_copywriting_admin_phrase_path(phrase, :dialog => true, :switch_locale => @current_locale, :height => 620),
:title => t('.edit') %>
<%= link_to refinery_icon_tag("delete.png"), refinery.copywriting_admin_phrase_path(phrase),
:title => t('.delete'),
:class => "cancel confirm-delete",
:confirm => t('message', :scope => 'refinery.admin.delete', :title => phrase.name.capitalize),
:method => :delete %>

<span class='actions'>
<%= action_icon(:edit, edit_url, t('edit', scope: 'refinery.admin.pages' ) ) %>
<%= action_icon(:delete, delete_url, t('delete', scope: 'refinery.admin.pages' ), delete_options )%>
</span>
</li>
2 changes: 1 addition & 1 deletion app/views/refinery/pages/admin/tabs/_copywriting.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
<% end %>
<% content_for :stylesheets do %>
<%= stylesheet_link_tag 'refinery/copywriting/backend' %>
<%= stylesheet_link_tag 'refinery/copywriting' %>
<% end %>
2 changes: 2 additions & 0 deletions lib/refinery/copywriting/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ class Engine < Rails::Engine
accepts_nested_attributes_for :copywriting_phrases, :allow_destroy => false
end
Decorators.register! ::Refinery::Copywriting.root

Rails.application.config.assets.precompile += %w(refinery/copywriting.css)
end

before_inclusion do
Expand Down
6 changes: 4 additions & 2 deletions refinerycms-copywriting.gemspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.name = 'refinerycms-copywriting'
s.version = '2.0.3'
s.version = '3.0.0'
s.date = '2011-07-20'
s.description = 'Extract all your strings and leave no human word behind, with i18n'
s.summary = 'Refinery CMS engine to manage copywriting, application wide or per pages, with i18n.'
Expand All @@ -11,5 +11,7 @@ Gem::Specification.new do |s|
s.require_paths = %w(lib)
s.files = Dir['lib/**/*', 'config/**/*', 'app/**/*', 'db/**/*', 'spec/**/*', 'features/**/*']

s.add_dependency 'decorators', '~> 2.0.0'
s.add_dependency 'refinerycms-core', '~> 3.0.0'
s.add_dependency 'decorators', '~> 2.0.0'
s.add_dependency 'globalize', '~> 5.0'
end
3 changes: 1 addition & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ def setup_environment
require File.expand_path("../dummy/config/environment", __FILE__)

require 'rspec/rails'
require 'factory_girl_rails'

Rails.backtrace_cleaner.remove_silencers!

Expand Down Expand Up @@ -51,4 +50,4 @@ def each_run
else
setup_environment
each_run
end
end

0 comments on commit ada998a

Please sign in to comment.