pulitzer 0.4.1 → 0.4.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d4ba76fb2ab1a9a028fccef98ba535797488e082
4
- data.tar.gz: 2ac42afaf4b83740e45cbe0b087532c99cd49385
3
+ metadata.gz: 349de1f3241b0779b75810a87af0007d9ae813b1
4
+ data.tar.gz: 5ced147d99a02930a5bc8b727d3fb591b46ad4bd
5
5
  SHA512:
6
- metadata.gz: 4ddaa9b9e4eefddc29997e39e3e07b383b0a795a3d75ee19b9cf4548d9ac468be847d97731b8762008ee3a84e7923a36c89c4c61b55b9e4a7ec9ee6b70c84be5
7
- data.tar.gz: 922f6cbb8cf5454cf3102bfa09658541eb0de47b06c336c70c019aaead4c9175ea03d357da13e59fd38c7f57ca711e208590cd5f3e7db4572b622af43148ff23
6
+ metadata.gz: 707c33cba7df7ce82113c8d17b9d9d4c7eecba3edae5bc73aa2a0f76e37eb2a8e8f2e2ca9952d1e86cbd9424f49778e4cb33bb3167406a4b12617f1db37ec54e
7
+ data.tar.gz: d32edbaa2efa3005e5fceb58efa568dad7d8d33f57a54266998b13c788e87a904f2760573016e54ecd8cb361d53afe9e6a30560d7ca2d479ebfff385f359c5a4
@@ -150,6 +150,10 @@ body {
150
150
  display: inline-block;
151
151
  width: 5px;
152
152
  }
153
+ &.match-h2{
154
+ line-height: 40px;
155
+ margin: 10px 0;
156
+ }
153
157
  &.match-h5{
154
158
  line-height: 20px;
155
159
  margin: 10px 0;
@@ -1,5 +1,5 @@
1
1
  class Pulitzer::PartialsController < Pulitzer::ApplicationController
2
- before_filter :set_partial, only: [:show, :edit, :update]
2
+ before_filter :set_partial, except: [:new, :create, :update_all]
3
3
 
4
4
  def new
5
5
  @partial = Pulitzer::Partial.new(partial_params)
@@ -33,13 +33,18 @@ class Pulitzer::PartialsController < Pulitzer::ApplicationController
33
33
 
34
34
  def update_all
35
35
  partials = Pulitzer::Partial.find params[:partial]
36
- partials.each do |ce|
37
- new_sort_order = params[:partial].index(ce.id.to_s)
38
- ce.update_attribute(:sort_order, new_sort_order)
36
+ partials.each do |partial|
37
+ new_sort_order = params[:partial].index(partial.id.to_s)
38
+ partial.update_attribute(:sort_order, new_sort_order)
39
39
  end
40
40
  render nothing: true
41
41
  end
42
42
 
43
+ def destroy
44
+ @partial.destroy
45
+ render nothing: true
46
+ end
47
+
43
48
  protected
44
49
 
45
50
  def partial_params
@@ -18,5 +18,15 @@ class Pulitzer::UpdatePostTypeContentElements
18
18
  post_type_content_element_type: ptcet)
19
19
  end
20
20
  end
21
+ post_type.partials.each do |partial|
22
+ partial.content_elements.where(label: old_label).each do |content_element|
23
+ content_element.update(label: ptcet.label,
24
+ height: ptcet.height,
25
+ width: ptcet.width,
26
+ text_editor: ptcet.text_editor,
27
+ content_element_type: ptcet.content_element_type,
28
+ post_type_content_element_type: ptcet)
29
+ end
30
+ end
21
31
  end
22
32
  end
@@ -2,7 +2,7 @@ module Pulitzer
2
2
  class FreeFormSection < ActiveRecord::Base
3
3
  belongs_to :version
4
4
  belongs_to :free_form_section_type
5
- has_many :partials
5
+ has_many :partials, -> { order :sort_order}
6
6
 
7
7
  def clone_me
8
8
  clone_attrs = self.attributes.dup
@@ -1,6 +1,7 @@
1
1
  class Pulitzer::PostType < ActiveRecord::Base
2
2
  enum kind: [ :template, :partial ]
3
3
  has_many :posts, dependent: :destroy
4
+ has_many :partials, dependent: :destroy
4
5
  has_many :post_type_content_element_types, dependent: :destroy
5
6
  has_many :content_element_types, through: :post_type_content_element_types
6
7
  has_many :free_form_section_types, dependent: :destroy
@@ -1,5 +1,10 @@
1
- <h2>Page content elements</h2>
2
-
3
- <% version.template_content_elements.each do |content_element| %>
4
- <%= render partial: '/pulitzer/content_elements/show_wrapper', locals: { content_element: content_element } %>
5
- <% end %>
1
+ <div class="pulitzer-row">
2
+ <div class="pulitzer-span margin match-h2" <%= expander(dom_id(version, :content_elements)) %>>&rtrif;</div>
3
+ <div class="pulitzer-span margin match-h2" <%= collapser(dom_id(version, :content_elements)) %>>&dtrif;</div>
4
+ <div class="pulitzer-span"><h2>Page content elements</h2></div>
5
+ </div>
6
+ <div <%= collapsed(dom_id(version, :content_elements)) %>>
7
+ <% version.template_content_elements.each do |content_element| %>
8
+ <%= render partial: '/pulitzer/content_elements/show_wrapper', locals: { content_element: content_element } %>
9
+ <% end %>
10
+ </div>
@@ -1,7 +1,15 @@
1
- <h3><%= partial.name %></h3>
1
+ <div class="pulitzer-row">
2
+ <div class="pulitzer-span margin"><h5><%= partial.name %></h5></div>
3
+ <div class="pulitzer-span right">
4
+ <%= render partial: '/pulitzer/shared/drag_handle' %>
5
+ </div>
6
+ </div>
2
7
  <%= render 'pulitzer/shared/error_messages', object: partial %>
3
8
  <%= form_for partial, html: ajax_form_hash(dom_target(partial)), multipart: true,
4
9
  data: { server_endpoint: partial_path(partial) } do |f| %>
10
+ <%= f.label :label %>
11
+ <%= f.text_field :label %>
12
+ <%= f.label :layout_id, 'Layout' %>
5
13
  <%= f.collection_select :layout_id, partial.available_layouts, :id, :name, {}, {} %>
6
14
  <%= submit_tag "Update" %>
7
15
  <%= link_to('Cancel', partial_path(partial), :class => 'button',
@@ -1,4 +1,4 @@
1
- <div id="<%= dom_id free_form_section, :partial_container %>">
1
+ <div id="<%= dom_id free_form_section, :partial_container %>" data-sorter href="<%= update_all_partials_path %>">
2
2
  <% free_form_section.partials.each do |partial| %>
3
3
  <%= render partial: '/pulitzer/partials/show_wrapper', locals: { partial: partial } %>
4
4
  <% end %>
@@ -1,10 +1,14 @@
1
1
  <%= render 'pulitzer/shared/error_messages', object: partial %>
2
2
  <%= form_for partial, html: ajax_form_hash(dom_target(partial.free_form_section, :partial_container), insert_method: 'append', empty_on_success: dom_target(partial.free_form_section, :new_partial)) do |f| %>
3
3
  <%= f.hidden_field :free_form_section_id %>
4
+ <%= f.label :label %>
5
+ <%= f.text_field :label %>
6
+ <%= f.label :post_type_id, 'Partial Type' %>
4
7
  <%= f.collection_select :post_type_id, Pulitzer::PostType.partials, :id, :name, {}, revealer(dom_id(partial.free_form_section, :new_partial_type), highlander: true) %>
5
8
  <div <%= revealer_target_attrs(dom_id(partial.free_form_section, :new_partial_type)) %>>
6
9
  <% Pulitzer::PostType.partials.each do |post_type| %>
7
10
  <div <%= revealer_option_attrs(dom_id(partial.free_form_section, :new_partial_type), trigger: post_type.id) %>>
11
+ <%= f.label :layout_id, 'Layout' %>
8
12
  <%= f.collection_select :layout_id, post_type.layouts, :id, :name, {}, {} %>
9
13
  </div>
10
14
  <% end %>
@@ -1,7 +1,14 @@
1
1
  <div class="pulitzer-row">
2
- <div class="pulitzer-span"><h5><%= partial.folder_path %>/</h5></div>
2
+ <div class="pulitzer-span margin match-h5" <%= expander(dom_id(partial)) %>>&rtrif;</div>
3
+ <div class="pulitzer-span margin match-h5" <%= collapser(dom_id(partial)) %>>&dtrif;</div>
4
+ <div class="pulitzer-span margin"><h5><%= partial.label %></h5></div>
5
+ <div class="pulitzer-span match-h5"><%= partial.folder_path %>/</div>
3
6
  <div class="pulitzer-span margin match-h5"><%= partial.template_path %></div>
4
7
  <div class="pulitzer-span match-h5"><%= ajax_link 'edit', edit_partial_path(partial), {}, dom_target(partial) %></div>
8
+ <div class="pulitzer-span right">
9
+ <%= render partial: '/pulitzer/shared/drag_handle' %>
10
+ </div>
5
11
  </div>
6
-
12
+ <div <%= collapsed(dom_id(partial)) %>>
7
13
  <%= render partial: '/pulitzer/content_elements/partial_index', locals: {partial: partial} %>
14
+ </div>
@@ -18,10 +18,16 @@
18
18
  <%= ajax_link "refresh preview", edit_version_path(version), {}, dom_target(version.post, :preview_version) %>
19
19
  <% elsif version.preview? %>
20
20
  <div class="pulitzer-row margin-bottom list-item">
21
- <h2>Tags</h2>
22
- <% Pulitzer::Post::TAG_MODELS.each do |tag_model| %>
23
- <%= render partial: 'pulitzer/post_tags/show_wrapper', locals: { version: version, tag_model: tag_model } %>
24
- <% end %>
21
+ <div class="pulitzer-row">
22
+ <div class="pulitzer-span margin match-h2" <%= expander(dom_id(version, :tags)) %>>&rtrif;</div>
23
+ <div class="pulitzer-span margin match-h2" <%= collapser(dom_id(version, :tags)) %>>&dtrif;</div>
24
+ <div class="pulitzer-span"><h2>Tags</h2></div>
25
+ </div>
26
+ <div <%= collapsed(dom_id(version, :tags)) %>>
27
+ <% Pulitzer::Post::TAG_MODELS.each do |tag_model| %>
28
+ <%= render partial: 'pulitzer/post_tags/show_wrapper', locals: { version: version, tag_model: tag_model } %>
29
+ <% end %>
30
+ </div>
25
31
  </div>
26
32
  <% if version.has_templated_content_elements? %>
27
33
  <div class="pulitzer-row margin-bottom list-item">
@@ -0,0 +1,5 @@
1
+ class AddLabelToPartial < ActiveRecord::Migration
2
+ def change
3
+ add_column :pulitzer_partials, :label, :string
4
+ end
5
+ end
@@ -27,6 +27,10 @@ module Pulitzer
27
27
  content_tag(:img, nil, options.merge(srcset: element.image_url(:cms)))
28
28
  end
29
29
 
30
+ def render_cms_image_path(element,options = {})
31
+ element.image_url(:cms)
32
+ end
33
+
30
34
  def render_video(element, options = {})
31
35
  content_tag(:iframe, nil, options.merge(src: element.video_link)) if element.video_link
32
36
  end
@@ -1,3 +1,3 @@
1
1
  module Pulitzer
2
- VERSION = '0.4.1'
2
+ VERSION = '0.4.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pulitzer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Draut
@@ -516,7 +516,6 @@ files:
516
516
  - app/views/pulitzer/layouts/_new.html.erb
517
517
  - app/views/pulitzer/layouts/_show.html.erb
518
518
  - app/views/pulitzer/layouts/_show_wrapper.html.erb
519
- - app/views/pulitzer/partials/_fields.html.erb
520
519
  - app/views/pulitzer/partials/_form.html.erb
521
520
  - app/views/pulitzer/partials/_index.html.erb
522
521
  - app/views/pulitzer/partials/_new.html.erb
@@ -573,6 +572,7 @@ files:
573
572
  - db/migrate/20160516150237_fix_post_type_kinds.rb
574
573
  - db/migrate/20160517181706_create_layouts.rb
575
574
  - db/migrate/20160517182500_add_layout_to_partial.rb
575
+ - db/migrate/20160519181030_add_label_to_partial.rb
576
576
  - lib/pulitzer.rb
577
577
  - lib/pulitzer/content_element_helper.rb
578
578
  - lib/pulitzer/engine.rb
@@ -1,2 +0,0 @@
1
- <%= f.collection_select :post_type_id, Pulitzer::PostType.partials, :id, :name, {}, {} %>
2
- <%= f.collection_select :layout_id, f.object.available_layouts, :id, :name, {}, {} %>