forked from SpinaCMS/Spina
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge changes from attachments en photo pickers
- Loading branch information
Showing
33 changed files
with
271 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,4 +16,4 @@ group :development, :test do | |
gem 'codeclimate-test-reporter', require: nil | ||
gem 'figaro' | ||
gem 'appraisal' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
@import spina | ||
|
||
.infinite-scroll | ||
@include clearfix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
hidden_input = $("input[name='<%= j params[:page_part_id] %>[page_partable_id]']") | ||
hidden_input.parents('.media_picker').find('.attachment').remove() | ||
hidden_input.parents('.media_picker').append("<div class='attachment'><%= @attachment.name %></div>") | ||
hidden_input.val("<%= @attachment.id %>") | ||
$.hideModal() |
This file was deleted.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
app/views/spina/admin/attachments/insert_collection.js.coffee
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
hidden_input = $("input[name='<%= j params[:page_part_id] %>[attachment_tokens]']") | ||
attachment_collection = $("<%= j render partial: 'attachment_collection', locals: {attachments: @attachments} %>") | ||
|
||
hidden_input.parents('.media_picker').find('.attachment').remove() | ||
hidden_input.parents('.media_picker').append(attachment_collection) | ||
hidden_input.val("<%= @attachments.map(&:id).join(',') %>") | ||
$.hideModal() |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 7 additions & 8 deletions
15
app/views/spina/admin/page_partables/attachments/_form.html.haml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
.horizontal-form-label | ||
= f.object.title | ||
.horizontal-form-content | ||
= link_to select_admin_attachments_path(f.object_name), remote: true, class: "media_picker" do | ||
.clearfix | ||
.placeholder.pull-right | ||
%span.button.button-small.button-round | ||
%i.icon.icon-dots | ||
= t('spina.choose_from_library') | ||
= link_to select_admin_attachments_path(f.object_name, selected_attachment_id: f.object.page_partable.id), remote: true, class: 'media_picker clearfix' do | ||
.placeholder.pull-right | ||
%span.button.button-small.button-round | ||
%i.icon.icon-dots | ||
= t('spina.choose_from_library') | ||
|
||
- if f.object.page_partable && f.object.page_partable.file.present? | ||
.attachment= f.object.page_partable.name | ||
- if f.object.page_partable && f.object.page_partable.file.present? | ||
.attachment= f.object.page_partable.name | ||
|
||
= f.hidden_field :page_partable_id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 6 additions & 10 deletions
16
app/views/spina/admin/page_partables/photos/_form.html.haml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,14 @@ | ||
.horizontal-form-label | ||
= f.object.title | ||
.horizontal-form-content | ||
= link_to spina.photo_select_admin_photos_path(f.object_name, selected_photo_id: (f.object.page_partable.id if f.object.page_partable.present?)), remote: true, class: "media_picker" do | ||
= link_to spina.photo_select_admin_photos_path(f.object_name, selected_photo_id: f.object.page_partable.id), remote: true, class: 'media_picker clearfix' do | ||
.placeholder.pull-right | ||
%span.button.button-small.button-round | ||
%i.icon.icon-dots | ||
=t 'spina.pages.photo_picker' | ||
|
||
- if f.object.page_partable && f.object.page_partable.file.present? | ||
.placeholder.pull-right | ||
%span.button.button-small.button-round | ||
%i.icon.icon-dots | ||
=t 'spina.pages.photo_picker' | ||
.image | ||
= image_tag f.object.page_partable.file.thumb | ||
- else | ||
.placeholder | ||
%span.button.button-small.button-round | ||
%i.icon.icon-dots | ||
=t 'spina.pages.photo_picker' | ||
|
||
= f.hidden_field :page_partable_id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
.item{class: ('selected' if @selected_photos.include?(photo_multi_picker))} | ||
= check_box_tag 'photo_ids[]', photo_multi_picker.id, @selected_photos.include?(photo_multi_picker) | ||
.item{class: ('selected' if photo_multi_picker.id.in?(@selected_photo_ids)) } | ||
= check_box_tag 'photo_ids[]', photo_multi_picker.id, photo_multi_picker.id.in?(@selected_photo_ids) | ||
= image_tag photo_multi_picker.file.thumb.url, id: "photo_#{photo_multi_picker.id}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
.item{class: ('selected' if @selected_photo == photo_single_picker)} | ||
= radio_button_tag :photo_id, photo_single_picker.id, photo_single_picker == @selected_photo | ||
.item{ class: ('selected' if photo_single_picker.id == @selected_photo_id) } | ||
= radio_button_tag :photo_id, photo_single_picker.id, photo_single_picker.id == @selected_photo_id | ||
= image_tag photo_single_picker.file.thumb.url, id: "photo_#{photo_single_picker.id}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
var hidden_input = $("input[name='<%= j params[:page_part_id] %>[page_partable_id]'], input[name='<%= j params[:page_part_id] %>[structure_partable_id]'], input[data-hidden-field='<%= j params[:hidden_field_id] %>']"); | ||
hidden_input.parents('.media_picker').find('.image, .placeholder').remove(); | ||
hidden_input.parents('.media_picker').find('.image').remove(); | ||
|
||
<% if @photo.present? %> | ||
hidden_input.parents('.media_picker').prepend("<div class='placeholder pull-right'><span class='button button-small button-round' data-icon='U'><%= I18n.t('spina.pages.photo_picker') %></span></div><div class='image'><img src='<%= @photo.file.thumb %>' /></div>"); | ||
hidden_input.parents('.media_picker').append("<div class='image'><img src='<%= @photo.file.thumb %>' /></div>"); | ||
hidden_input.val("<%= @photo.id %>"); | ||
<% else %> | ||
hidden_input.parents('.media_picker').prepend("<div class='placeholder'><span class='button button-small button-round' data-icon='U'><%= I18n.t('spina.pages.photo_picker') %></span></div>"); | ||
hidden_input.parents('.media_picker').append("<input type='hidden' type='checkbox' name='<%= j params[:page_part_id] %>[_destroy]' value='1' />") | ||
<% end %> | ||
$.hideModal(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 3 additions & 6 deletions
9
app/views/spina/admin/structure_partables/photos/_form.html.haml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,8 @@ | ||
= link_to spina.photo_select_admin_photos_path(f.object_name, selected_photo_id: (f.object.structure_partable.id if f.object.structure_partable.present?)), remote: true, class: "media_picker" do | ||
= link_to spina.photo_select_admin_photos_path(f.object_name, selected_photo_id: f.object.structure_partable.id), remote: true, class: "media_picker" do | ||
.placeholder.pull-right | ||
%span.button.button-small.button-round{data: {icon: 'U'}}=t 'spina.pages.photo_picker' | ||
- if f.object.structure_partable && f.object.structure_partable.file.present? | ||
.placeholder.pull-right | ||
%span.button.button-small.button-round{data: {icon: 'U'}}=t 'spina.pages.photo_picker' | ||
.image | ||
= image_tag f.object.structure_partable.file.thumb | ||
- else | ||
.placeholder | ||
%span.button.button-small.button-round{data: {icon: 'U'}}=t 'spina.pages.photo_picker' | ||
|
||
= f.hidden_field :structure_partable_id |
Oops, something went wrong.