refinerycms-snippets 0.4.1 → 0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/app/controllers/admin/{snippets_page_controller.rb → snippets_page_parts_controller.rb} +10 -6
- data/app/models/snippet.rb +25 -10
- data/app/models/snippet_page_part.rb +14 -0
- data/app/views/admin/pages/tabs/_snippets_content.html.erb +13 -3
- data/app/views/admin/pages/tabs/_snippets_field.html.erb +40 -44
- data/app/views/admin/pages/tabs/_snippets_list_item.html.erb +20 -0
- data/app/views/admin/{snippets_page → snippets_page_parts}/add.html.erb +0 -0
- data/app/views/admin/{snippets_page → snippets_page_parts}/remove.html.erb +0 -0
- data/config/locales/en.yml +5 -1
- data/config/routes.rb +1 -1
- data/db/migrate/4_create_snippets_page_parts.rb +19 -0
- data/db/migrate/5_drop_snippet_page.rb +20 -0
- data/lib/extensions/page_extensions.rb +25 -0
- data/lib/extensions/pages_helper_extensions.rb +35 -0
- data/lib/refinerycms-snippets.rb +17 -9
- data/public/javascripts/page-snippet-picker.js +6 -2
- data/public/javascripts/part-snippets-select.js +40 -0
- data/public/stylesheets/page-snippet-picker.css +36 -5
- metadata +15 -11
data/app/controllers/admin/{snippets_page_controller.rb → snippets_page_parts_controller.rb}
RENAMED
@@ -1,14 +1,16 @@
|
|
1
1
|
module Admin
|
2
|
-
class
|
2
|
+
class SnippetsPagePartsController < Admin::BaseController
|
3
3
|
|
4
4
|
def add
|
5
5
|
@page = Page.find(params[:id])
|
6
|
+
@part = PagePart.find(params[:part_id])
|
6
7
|
@snippet = Snippet.find(params[:snippet_id])
|
7
|
-
|
8
|
-
|
8
|
+
before_body = params[:before_body] == 'true' ? true : false
|
9
|
+
|
10
|
+
sp = SnippetPagePart.new(:page_part => @part, :snippet => @snippet, :before_body => before_body)
|
9
11
|
|
10
12
|
if sp.save
|
11
|
-
flash[:notice] = "Snippet #{@snippet.title} was successfully added
|
13
|
+
flash[:notice] = "Snippet #{@snippet.title} was successfully added."
|
12
14
|
end
|
13
15
|
|
14
16
|
render :layout => false if request.xhr?
|
@@ -16,14 +18,16 @@ module Admin
|
|
16
18
|
|
17
19
|
def remove
|
18
20
|
@page = Page.find(params[:id])
|
21
|
+
@part = PagePart.find(params[:part_id])
|
19
22
|
@snippet = Snippet.find(params[:snippet_id])
|
23
|
+
before_body = params[:before_body] == 'true' ? true : false
|
20
24
|
|
21
|
-
sp =
|
25
|
+
sp = SnippetPagePart.where(:page_part_id => @part, :snippet_id => @snippet, :before_body => before_body)
|
22
26
|
|
23
27
|
removed = sp.first.destroy() unless sp.empty?
|
24
28
|
|
25
29
|
if removed
|
26
|
-
flash[:notice] = "Snippet #{@snippet.title} was successfully removed
|
30
|
+
flash[:notice] = "Snippet #{@snippet.title} was successfully removed."
|
27
31
|
end
|
28
32
|
|
29
33
|
render :layout => false if request.xhr?
|
data/app/models/snippet.rb
CHANGED
@@ -1,27 +1,42 @@
|
|
1
1
|
class Snippet < ActiveRecord::Base
|
2
|
-
|
2
|
+
|
3
3
|
acts_as_indexed :fields => [:title, :body]
|
4
4
|
|
5
5
|
validates :title, :presence => true, :uniqueness => true
|
6
6
|
|
7
7
|
translates :body
|
8
8
|
|
9
|
-
has_many :
|
10
|
-
has_many :
|
9
|
+
has_many :snippet_page_parts, :dependent => :destroy
|
10
|
+
has_many :page_parts, :through => :snippet_page_parts
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
snippets = snippets.where('id NOT IN (?)', @page.snippets) unless @page.snippets.empty?
|
16
|
-
snippets
|
17
|
-
end
|
12
|
+
named_scope :for_page, lambda{ |page|
|
13
|
+
raise RuntimeError.new("Couldn't find Snippet for a nil Page") if page.blank?
|
14
|
+
joins(:page_parts => :page).where(:pages => {:id => page.id})
|
18
15
|
|
16
|
+
}
|
17
|
+
|
18
|
+
scope :before, where(:snippets_page_parts => {:before_body => true})
|
19
|
+
scope :after, where(:snippets_page_parts => {:before_body => false})
|
20
|
+
|
19
21
|
# rejects any page that has not been translated to the current locale.
|
20
22
|
scope :translated, lambda {
|
21
23
|
pages = Arel::Table.new(Snippet.table_name)
|
22
24
|
translations = Arel::Table.new(Snippet.translations_table_name)
|
23
25
|
|
24
26
|
includes(:translations).where(
|
25
|
-
|
27
|
+
translations[:locale].eq(Globalize.locale)).where(pages[:id].eq(translations[:snippet_id]))
|
26
28
|
}
|
29
|
+
|
30
|
+
def pages
|
31
|
+
Page.for_snippet(self)
|
32
|
+
end
|
33
|
+
|
34
|
+
def before?(part)
|
35
|
+
part.snippets.before.include? self
|
36
|
+
end
|
37
|
+
|
38
|
+
def after?(part)
|
39
|
+
part.snippets.after.include? self
|
40
|
+
end
|
41
|
+
|
27
42
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class SnippetPagePart < ActiveRecord::Base
|
2
|
+
|
3
|
+
set_table_name 'snippets_page_parts'
|
4
|
+
|
5
|
+
belongs_to :snippet, :foreign_key => :snippet_id
|
6
|
+
belongs_to :page_part, :foreign_key => :page_part_id
|
7
|
+
|
8
|
+
validates_uniqueness_of :snippet_id, :scope => [:page_part_id, :before_body]
|
9
|
+
|
10
|
+
before_save do |snippet_page_part|
|
11
|
+
snippet_page_part.position = (SnippetPagePart.where('page_part_id = ?', snippet_page_part.page_part_id).maximum(:position) || -1) + 1
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
@@ -1,7 +1,14 @@
|
|
1
1
|
<% if @page.new_record? %>
|
2
|
-
<div class="msg alert"><%= t('.please_save_page_before') %></div>
|
2
|
+
<div class="msg alert"><%= t('.please_save_page_before') %></div>
|
3
3
|
<% else %>
|
4
|
-
|
4
|
+
<div id="part-snippets-menu">
|
5
|
+
<ul>
|
6
|
+
<% @page.parts.each do |part|%>
|
7
|
+
<li><%= link_to(part.title, :anchor => "part-#{part.id}") %> |</li>
|
8
|
+
<% end %>
|
9
|
+
</ul>
|
10
|
+
</div>
|
11
|
+
<%= render :partial => '/admin/pages/tabs/snippets_field', :collection => @page.parts, :as => :part %>
|
5
12
|
<% end %>
|
6
13
|
|
7
14
|
<% content_for :stylesheets do %>
|
@@ -9,4 +16,7 @@
|
|
9
16
|
<% end %>
|
10
17
|
<% content_for :javascripts do %>
|
11
18
|
<%= javascript_include_tag 'page-snippet-picker' %>
|
12
|
-
<% end %>
|
19
|
+
<% end %>
|
20
|
+
<% content_for :javascripts do %>
|
21
|
+
<%= javascript_include_tag 'part-snippets-select' %>
|
22
|
+
<% end %>
|
@@ -1,52 +1,48 @@
|
|
1
|
-
<div id="
|
2
|
-
|
3
|
-
<
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
</span>
|
18
|
-
<span class='actions'>
|
19
|
-
<%= link_to refinery_icon_tag('application_edit.png'), edit_admin_snippet_path(snippet),
|
20
|
-
:title => t('.edit') %>
|
21
|
-
<%= link_to refinery_icon_tag('delete.png'), url_for({:controller => 'snippets_page', :action => 'remove', :snippet_id => snippet.id, :id => @page.id}),
|
22
|
-
:title => t('.remove'),
|
23
|
-
:class => 'remove-snippet' %>
|
24
|
-
</span>
|
25
|
-
</li>
|
26
|
-
<% end %>
|
27
|
-
</ul>
|
28
|
-
<% end %>
|
29
|
-
</div>
|
1
|
+
<div id="<%= "part-#{part.id}" %>" class="part-snippets">
|
2
|
+
<h1><%= part.title %></h1>
|
3
|
+
<div class="active-snippets">
|
4
|
+
<% if part.snippets.before.any? %>
|
5
|
+
<h2><%= t('.before_body') %></h2>
|
6
|
+
<ul>
|
7
|
+
<%= render :partial => '/admin/pages/tabs/snippets_list_item', :collection => part.snippets.before, :as => :snippet, :locals => {:part => part, :before_body => true} %>
|
8
|
+
</ul>
|
9
|
+
<% end %>
|
10
|
+
<% if part.snippets.after.any? %>
|
11
|
+
<h2><%= t('.after_body') %></h2>
|
12
|
+
<ul>
|
13
|
+
<%= render :partial => '/admin/pages/tabs/snippets_list_item', :collection => part.snippets.after, :as => :snippet, :locals => {:part => part, :before_body => false} %>
|
14
|
+
</ul>
|
15
|
+
<% end %>
|
16
|
+
</div>
|
30
17
|
|
31
|
-
<div
|
32
|
-
<% inactive_snippets = Snippet.
|
33
|
-
<% if inactive_snippets.length > 0 %>
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
18
|
+
<div class="inactive-snippets">
|
19
|
+
<% inactive_snippets = Snippet.all %>
|
20
|
+
<% if inactive_snippets.length > 0 %>
|
21
|
+
<h2><%= t('.inactive') %></h2>
|
22
|
+
<ul>
|
23
|
+
<% inactive_snippets.each do |snippet| %>
|
24
|
+
<li class='clearfix record <%= cycle('on', 'on-hover') %>' >
|
25
|
+
<span class="title"><%= snippet.title %></span>
|
26
|
+
<div class="actions">
|
27
|
+
<% unless snippet.after?(part) %>
|
28
|
+
<%= link_to t('.add_after_body'), {:controller => 'snippets_page_parts', :action => 'add', :id => @page.id, :snippet_id => snippet.id, :part_id => part.id}, :class => 'add_icon add-snippet' %>
|
29
|
+
<% else %>
|
30
|
+
<span class="add_icon add-snippet"><%= t('.add_after_body') %></span>
|
31
|
+
<% end %>
|
32
|
+
<% unless snippet.before?(part) %>
|
33
|
+
<%= link_to t('.add_before_body'), {:controller => 'snippets_page_parts', :action => 'add', :id => @page.id, :snippet_id => snippet.id, :part_id => part.id, :before_body => 'true'}, :class => 'add_icon add-snippet' %>
|
34
|
+
<% else %>
|
35
|
+
<span class="add_icon add-snippet"><%= t('.add_before_body') %></span>
|
36
|
+
<% end %>
|
37
|
+
</div>
|
38
|
+
</li>
|
39
|
+
<% end %>
|
40
|
+
</ul>
|
43
41
|
<% end %>
|
44
|
-
</
|
45
|
-
<% end %>
|
42
|
+
</div>
|
46
43
|
</div>
|
47
44
|
|
48
45
|
|
49
46
|
|
50
47
|
|
51
48
|
|
52
|
-
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<li class='clearfix record <%= cycle('on', 'on-hover') %>' >
|
2
|
+
<span class='title'>
|
3
|
+
<%= snippet.title %>
|
4
|
+
<% if ::Refinery::I18n.frontend_locales.many? and
|
5
|
+
(locales = snippet.translations.collect{|t| t.locale}).present? %>
|
6
|
+
<span class='preview'>
|
7
|
+
<% locales.each do |locale| %>
|
8
|
+
<%= refinery_icon_tag "flags/#{locale}.png", :size => '16x11' %>
|
9
|
+
<% end %>
|
10
|
+
</span>
|
11
|
+
<% end %>
|
12
|
+
</span>
|
13
|
+
<span class='actions'>
|
14
|
+
<%= link_to refinery_icon_tag('application_edit.png'), edit_admin_snippet_path(snippet),
|
15
|
+
:title => t('.edit') %>
|
16
|
+
<%= link_to refinery_icon_tag('delete.png'), url_for({:controller => 'snippets_page_parts', :action => 'remove', :id => @page.id, :snippet_id => snippet.id, :part_id => part.id, :before_body => before_body}),
|
17
|
+
:title => t('.remove'),
|
18
|
+
:class => 'remove-snippet' %>
|
19
|
+
</span>
|
20
|
+
</li>
|
File without changes
|
File without changes
|
data/config/locales/en.yml
CHANGED
@@ -23,9 +23,13 @@ en:
|
|
23
23
|
snippets_field:
|
24
24
|
active: Active
|
25
25
|
inactive: Inactive
|
26
|
+
add_after_body: Add after body
|
27
|
+
add_before_body: Add before body
|
28
|
+
after_body: After body
|
29
|
+
before_body: Before body
|
30
|
+
snippets_list_item:
|
26
31
|
remove: Remove
|
27
32
|
edit: Edit
|
28
|
-
add: Add
|
29
33
|
snippets:
|
30
34
|
show:
|
31
35
|
other: Other Snippets
|
data/config/routes.rb
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
class CreateSnippetsPageParts < ActiveRecord::Migration
|
2
|
+
|
3
|
+
def self.up
|
4
|
+
create_table :snippets_page_parts do |t|
|
5
|
+
t.integer :snippet_id, :null => false, :references => [:snippets, :id]
|
6
|
+
t.integer :page_part_id, :null => false, :references => [:page_parts, :id]
|
7
|
+
t.integer :position, :null => false, :default => 0
|
8
|
+
t.boolean :before_body, :null => false, :default => false
|
9
|
+
end
|
10
|
+
|
11
|
+
add_index :snippets_page_parts, :snippet_id
|
12
|
+
add_index :snippets_page_parts, :page_part_id
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.down
|
16
|
+
drop_table :snippet_page_parts
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class DropSnippetPage < ActiveRecord::Migration
|
2
|
+
|
3
|
+
def self.up
|
4
|
+
remove_index :snippet_page, :snippet_id
|
5
|
+
remove_index :snippet_page, :page_id
|
6
|
+
drop_table :snippet_page
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.down
|
10
|
+
create_table :snippet_page do |t|
|
11
|
+
t.integer :snippet_id, :null => false, :references => [:snippets, :id]
|
12
|
+
t.integer :page_id, :null => false, :references => [:pages, :id]
|
13
|
+
t.integer :position, :null => false, :default => 0
|
14
|
+
end
|
15
|
+
|
16
|
+
add_index :snippet_page, :snippet_id
|
17
|
+
add_index :snippet_page, :page_id
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Extensions
|
2
|
+
module Page
|
3
|
+
|
4
|
+
def self.included(base)
|
5
|
+
|
6
|
+
base.class_eval do
|
7
|
+
|
8
|
+
named_scope :for_snippet, lambda{ |snippet|
|
9
|
+
raise RuntimeError.new("Couldn't find Pages for a nil Snippet") if snippet.blank?
|
10
|
+
{
|
11
|
+
:joins => {:parts, :snippets},
|
12
|
+
:conditions => {:snippets_page_parts => {:snippet_id => snippet.id}}
|
13
|
+
}
|
14
|
+
}
|
15
|
+
|
16
|
+
def snippets
|
17
|
+
Snippet.for_page(self)
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Extensions
|
2
|
+
module PagesHelper
|
3
|
+
|
4
|
+
def self.included(base)
|
5
|
+
base.class_eval do
|
6
|
+
|
7
|
+
##
|
8
|
+
# Accessor method to get a page part from a page.
|
9
|
+
# Example:
|
10
|
+
#
|
11
|
+
# content_of(Page.first, :body)
|
12
|
+
#
|
13
|
+
# Will return the body page part of the first page wrap with its
|
14
|
+
# attached snippets.
|
15
|
+
def content_of(page, part_title)
|
16
|
+
part = page.parts.detect do |part|
|
17
|
+
part.title.present? and #protecting against the problem that occurs when have nil title
|
18
|
+
part.title == part_title.to_s or
|
19
|
+
part.title.downcase.gsub(" ", "_") == part_title.to_s.downcase.gsub(" ", "_")
|
20
|
+
end
|
21
|
+
|
22
|
+
if part
|
23
|
+
content = ""
|
24
|
+
content += part.snippets.before.map{|snippet| snippet.try(:body)}.join
|
25
|
+
part_body = part.try(:body)
|
26
|
+
content += part_body unless part_body.nil?
|
27
|
+
content += part.snippets.after.map{|snippet| snippet.try(:body)}.join
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
data/lib/refinerycms-snippets.rb
CHANGED
@@ -3,19 +3,27 @@ require 'refinerycms-base'
|
|
3
3
|
module Refinery
|
4
4
|
module Snippets
|
5
5
|
class Engine < Rails::Engine
|
6
|
+
|
7
|
+
config.before_initialize do
|
8
|
+
require 'extensions/page_extensions'
|
9
|
+
require 'extensions/pages_helper_extensions'
|
10
|
+
end
|
11
|
+
|
6
12
|
initializer "static assets" do |app|
|
7
13
|
app.middleware.insert_after ::ActionDispatch::Static, ::ActionDispatch::Static, "#{root}/public"
|
8
14
|
end
|
9
|
-
|
15
|
+
|
10
16
|
config.to_prepare do
|
11
|
-
|
12
|
-
has_many :
|
13
|
-
has_many :snippets, :through => :
|
17
|
+
PagePart.module_eval do
|
18
|
+
has_many :snippet_page_parts, :dependent => :destroy
|
19
|
+
has_many :snippets, :through => :snippet_page_parts, :order => 'position ASC'
|
14
20
|
end
|
21
|
+
Page.send :include, Extensions::Page
|
22
|
+
PagesHelper.send :include, Extensions::PagesHelper
|
15
23
|
end
|
16
24
|
|
17
25
|
config.after_initialize do
|
18
|
-
|
26
|
+
::Refinery::Pages::Tab.register do |tab|
|
19
27
|
tab.name = "snippets"
|
20
28
|
tab.partial = "/admin/pages/tabs/snippets"
|
21
29
|
end
|
@@ -24,10 +32,10 @@ module Refinery
|
|
24
32
|
plugin.url = {:controller => '/admin/snippets'}
|
25
33
|
plugin.menu_match = /^\/?(admin|refinery)\/snippets/
|
26
34
|
plugin.activity = [{
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
35
|
+
:class => Snippet
|
36
|
+
}, {
|
37
|
+
:class => SnippetPage
|
38
|
+
}]
|
31
39
|
end
|
32
40
|
end
|
33
41
|
end
|
@@ -34,7 +34,7 @@ $(document).ready(function (cms) {
|
|
34
34
|
|
35
35
|
if (!this.processing) {
|
36
36
|
this.spinner_on();
|
37
|
-
|
37
|
+
var partId = $('#part-snippets-select').val();
|
38
38
|
$.ajax({
|
39
39
|
url: add_url,
|
40
40
|
type: 'GET',
|
@@ -45,6 +45,8 @@ $(document).ready(function (cms) {
|
|
45
45
|
},
|
46
46
|
success: function (response) {
|
47
47
|
that.update(response);
|
48
|
+
cms.plugin.PartSnippetsSelect.init();
|
49
|
+
$('#part-snippets-select').val(partId).change();
|
48
50
|
}
|
49
51
|
});
|
50
52
|
}
|
@@ -56,7 +58,7 @@ $(document).ready(function (cms) {
|
|
56
58
|
|
57
59
|
if (!this.processing) {
|
58
60
|
this.spinner_on();
|
59
|
-
|
61
|
+
var partId = $('#part-snippets-select').val();
|
60
62
|
// console.log('remove start');
|
61
63
|
$.ajax({
|
62
64
|
url: remove_url,
|
@@ -69,6 +71,8 @@ $(document).ready(function (cms) {
|
|
69
71
|
},
|
70
72
|
success: function (response) {
|
71
73
|
that.update(response);
|
74
|
+
cms.plugin.PartSnippetsSelect.init();
|
75
|
+
$('#part-snippets-select').val(partId).change();
|
72
76
|
}
|
73
77
|
});
|
74
78
|
}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
$(document).ready(function (cms) {
|
2
|
+
cms = cms || {};
|
3
|
+
cms.plugin = cms.plugin || {};
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Generates a drop-down box for changing the displayed page part
|
7
|
+
* in the snippets tab in the edit page interface.
|
8
|
+
*/
|
9
|
+
cms.plugin.PartSnippetsSelect = {
|
10
|
+
|
11
|
+
init: function() {
|
12
|
+
$('#part-snippets-menu').html(this.generateWidget());
|
13
|
+
this.changeVisiblePart();
|
14
|
+
$('#part-snippets-select').change(this.changeVisiblePart);
|
15
|
+
},
|
16
|
+
|
17
|
+
/**
|
18
|
+
* Writes the html code for the drop-down box.
|
19
|
+
*/
|
20
|
+
generateWidget: function() {
|
21
|
+
select = '<select id="part-snippets-select">';
|
22
|
+
$('#part-snippets-menu a').each(function(i,e) {
|
23
|
+
select += '<option value="'+$(e).attr('href').split('#',2)[1]+'">'
|
24
|
+
select += e.text
|
25
|
+
select += '</option>'
|
26
|
+
});
|
27
|
+
select += '</select>';
|
28
|
+
return select;
|
29
|
+
},
|
30
|
+
|
31
|
+
changeVisiblePart: function() {
|
32
|
+
$('.part-snippets').css('display', 'none');
|
33
|
+
$('#'+$('#part-snippets-select').val()).css('display', 'block');
|
34
|
+
},
|
35
|
+
|
36
|
+
}
|
37
|
+
|
38
|
+
cms.plugin.PartSnippetsSelect.init();
|
39
|
+
|
40
|
+
});
|
@@ -6,25 +6,32 @@
|
|
6
6
|
Styles for snippets administrations
|
7
7
|
*/
|
8
8
|
|
9
|
-
a.add-snippet
|
9
|
+
a.add-snippet,
|
10
|
+
span.add-snippet {
|
10
11
|
background-repeat: no-repeat;
|
11
12
|
background-position: left center;
|
12
13
|
border: none;
|
13
14
|
padding-left: 20px;
|
14
15
|
}
|
15
16
|
|
16
|
-
|
17
|
+
span.add-snippet {
|
18
|
+
float: right;
|
19
|
+
color: lightGray;
|
20
|
+
margin: 3px;
|
21
|
+
}
|
22
|
+
|
23
|
+
.part-snippets ul {
|
17
24
|
background: #fff;
|
18
25
|
padding: 10px;
|
19
26
|
padding-bottom: 0px;
|
20
27
|
margin-bottom: 5px;
|
21
28
|
}
|
22
29
|
|
23
|
-
|
30
|
+
.active-snippets ul {
|
24
31
|
margin-bottom: 15px;
|
25
32
|
}
|
26
33
|
|
27
|
-
|
34
|
+
.inactive-snippets ul {
|
28
35
|
background: #fcfcfc;
|
29
36
|
}
|
30
37
|
|
@@ -36,4 +43,28 @@ a.add-snippet {
|
|
36
43
|
.msg.alert {
|
37
44
|
color: #f66;
|
38
45
|
background: #fff;
|
39
|
-
}
|
46
|
+
}
|
47
|
+
|
48
|
+
#page_snippet_picker h1 {
|
49
|
+
text-align: left;
|
50
|
+
}
|
51
|
+
|
52
|
+
.part-snippets {
|
53
|
+
margin-bottom: 5ex;
|
54
|
+
}
|
55
|
+
|
56
|
+
.part-snippets:last-child {
|
57
|
+
margin-bottom: 0;
|
58
|
+
}
|
59
|
+
|
60
|
+
#page_snippet_picker div.actions {
|
61
|
+
display: inline;
|
62
|
+
}
|
63
|
+
|
64
|
+
#part-snippets-menu {
|
65
|
+
margin: 1ex;
|
66
|
+
}
|
67
|
+
|
68
|
+
#part-snippets-menu li {
|
69
|
+
display: inline;
|
70
|
+
}
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: refinerycms-snippets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 1
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
|
10
|
-
version: 0.4.1
|
8
|
+
- 5
|
9
|
+
version: "0.5"
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Marek L.
|
@@ -15,8 +14,7 @@ autorequire:
|
|
15
14
|
bindir: bin
|
16
15
|
cert_chain: []
|
17
16
|
|
18
|
-
date: 2011-
|
19
|
-
default_executable:
|
17
|
+
date: 2011-11-07 00:00:00 Z
|
20
18
|
dependencies:
|
21
19
|
- !ruby/object:Gem::Dependency
|
22
20
|
name: refinerycms-pages
|
@@ -45,13 +43,16 @@ extra_rdoc_files: []
|
|
45
43
|
|
46
44
|
files:
|
47
45
|
- lib/generators/refinerycms_snippets_generator.rb
|
46
|
+
- lib/extensions/pages_helper_extensions.rb
|
47
|
+
- lib/extensions/page_extensions.rb
|
48
48
|
- lib/refinerycms-snippets.rb
|
49
49
|
- lib/tasks/snippets.rake
|
50
50
|
- config/routes.rb
|
51
51
|
- config/locales/en.yml
|
52
52
|
- config/locales/nl.yml
|
53
53
|
- app/controllers/admin/snippets_controller.rb
|
54
|
-
- app/controllers/admin/
|
54
|
+
- app/controllers/admin/snippets_page_parts_controller.rb
|
55
|
+
- app/models/snippet_page_part.rb
|
55
56
|
- app/models/snippet_page.rb
|
56
57
|
- app/models/snippet.rb
|
57
58
|
- app/views/admin/snippets/_snippets.html.erb
|
@@ -65,18 +66,21 @@ files:
|
|
65
66
|
- app/views/admin/snippets/_locale_picker.html.erb
|
66
67
|
- app/views/admin/snippets/_actions.html.erb
|
67
68
|
- app/views/admin/snippets/_snippet.html.erb
|
68
|
-
- app/views/admin/
|
69
|
-
- app/views/admin/
|
69
|
+
- app/views/admin/snippets_page_parts/remove.html.erb
|
70
|
+
- app/views/admin/snippets_page_parts/add.html.erb
|
70
71
|
- app/views/admin/pages/tabs/_snippets.html.erb
|
72
|
+
- app/views/admin/pages/tabs/_snippets_list_item.html.erb
|
71
73
|
- app/views/admin/pages/tabs/_snippets_content.html.erb
|
72
74
|
- app/views/admin/pages/tabs/_snippets_field.html.erb
|
75
|
+
- db/migrate/5_drop_snippet_page.rb
|
76
|
+
- db/migrate/4_create_snippets_page_parts.rb
|
73
77
|
- db/migrate/2_create_snippet_page.rb
|
74
78
|
- db/migrate/1_create_snippets.rb
|
75
79
|
- db/migrate/3_translate_snippets.rb
|
76
80
|
- db/seeds/snippets.rb
|
81
|
+
- public/javascripts/part-snippets-select.js
|
77
82
|
- public/javascripts/page-snippet-picker.js
|
78
83
|
- public/stylesheets/page-snippet-picker.css
|
79
|
-
has_rdoc: true
|
80
84
|
homepage:
|
81
85
|
licenses: []
|
82
86
|
|
@@ -106,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
110
|
requirements: []
|
107
111
|
|
108
112
|
rubyforge_project:
|
109
|
-
rubygems_version: 1.
|
113
|
+
rubygems_version: 1.8.4
|
110
114
|
signing_key:
|
111
115
|
specification_version: 3
|
112
116
|
summary: Html snippets for Refinery CMS page
|