kuppayam 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +27 -4
  3. data/app/assets/javascripts/kuppayam/utilities.js +110 -5
  4. data/app/assets/javascripts/kuppayam.js +4 -0
  5. data/app/assets/stylesheets/kuppayam/custom.css +48 -1
  6. data/app/assets/stylesheets/kuppayam.css +1 -0
  7. data/app/assets/stylesheets/wysiwyg-color.css +15 -0
  8. data/app/controllers/kuppayam/base_controller.rb +24 -3
  9. data/app/controllers/kuppayam/documents_controller.rb +104 -0
  10. data/app/controllers/kuppayam/images_controller.rb +104 -0
  11. data/app/controllers/kuppayam/import_data_controller.rb +34 -0
  12. data/app/controllers/kuppayam/resource_controller.rb +9 -0
  13. data/app/helpers/breadcrumbs_helper.rb +32 -15
  14. data/app/helpers/document_helper.rb +40 -0
  15. data/app/helpers/flash_helper.rb +0 -8
  16. data/app/helpers/image_helper.rb +57 -88
  17. data/app/helpers/notification_helper.rb +41 -0
  18. data/app/helpers/render_helper.rb +44 -5
  19. data/app/helpers/resource_helper.rb +107 -52
  20. data/app/models/document/base.rb +43 -0
  21. data/app/models/image/base.rb +52 -0
  22. data/app/models/import_data.rb +20 -0
  23. data/app/models/kuppayam/application_record.rb +5 -0
  24. data/app/uploaders/document_uploader.rb +15 -0
  25. data/app/uploaders/image_uploader.rb +90 -0
  26. data/app/views/kuppayam/documents/_crop_form.html.erb +44 -0
  27. data/app/views/kuppayam/documents/_form.html.erb +47 -0
  28. data/app/views/kuppayam/documents/_new.html.erb +9 -0
  29. data/app/views/kuppayam/documents/_photos.html.erb +16 -0
  30. data/app/views/kuppayam/documents/create.html.erb +14 -0
  31. data/app/views/kuppayam/documents/crop.html.erb +9 -0
  32. data/app/views/kuppayam/documents/edit.js.erb +7 -0
  33. data/app/views/kuppayam/documents/new.js.erb +7 -0
  34. data/app/views/kuppayam/documents/update.html.erb +14 -0
  35. data/app/views/kuppayam/images/_action_buttons.html.erb +14 -0
  36. data/app/views/kuppayam/images/_crop_form.html.erb +44 -0
  37. data/app/views/kuppayam/images/_form.html.erb +56 -0
  38. data/app/views/kuppayam/images/_index.html.erb +49 -0
  39. data/app/views/kuppayam/images/_new.html.erb +9 -0
  40. data/app/views/kuppayam/images/_photos.html.erb +16 -0
  41. data/app/views/kuppayam/images/_row.html.erb +65 -0
  42. data/app/views/kuppayam/images/create.html.erb +38 -0
  43. data/app/views/kuppayam/images/crop.html.erb +9 -0
  44. data/app/views/kuppayam/images/edit.js.erb +8 -0
  45. data/app/views/kuppayam/images/index.html.erb +26 -0
  46. data/app/views/kuppayam/images/new.js.erb +8 -0
  47. data/app/views/kuppayam/images/update.html.erb +38 -0
  48. data/app/views/kuppayam/import_data/_form.html.erb +38 -0
  49. data/app/views/kuppayam/import_data/_new.html.erb +9 -0
  50. data/app/views/kuppayam/import_data/_photos.html.erb +16 -0
  51. data/app/views/kuppayam/import_data/create.html.erb +14 -0
  52. data/app/views/kuppayam/import_data/crop.html.erb +9 -0
  53. data/app/views/kuppayam/import_data/edit.js.erb +7 -0
  54. data/app/views/kuppayam/import_data/new.js.erb +11 -0
  55. data/app/views/kuppayam/import_data/update.html.erb +14 -0
  56. data/app/views/kuppayam/workflows/parrot/_info.html.erb +15 -0
  57. data/app/views/kuppayam/workflows/parrot/create.js.erb +36 -0
  58. data/app/views/kuppayam/workflows/parrot/destroy.js.erb +22 -0
  59. data/app/views/kuppayam/workflows/parrot/edit.js.erb +10 -0
  60. data/app/views/kuppayam/workflows/parrot/index.js.erb +14 -0
  61. data/app/views/kuppayam/workflows/parrot/new.js.erb +9 -0
  62. data/app/views/kuppayam/workflows/parrot/row.js.erb +24 -0
  63. data/app/views/kuppayam/workflows/parrot/show.js.erb +13 -0
  64. data/app/views/kuppayam/workflows/parrot/update.js.erb +34 -0
  65. data/app/views/kuppayam/workflows/peacock/_info.html.erb +15 -0
  66. data/app/views/kuppayam/workflows/peacock/create.js.erb +36 -0
  67. data/app/views/kuppayam/workflows/peacock/destroy.js.erb +22 -0
  68. data/app/views/kuppayam/workflows/peacock/edit.js.erb +10 -0
  69. data/app/views/kuppayam/workflows/peacock/index.js.erb +14 -0
  70. data/app/views/kuppayam/workflows/peacock/new.js.erb +9 -0
  71. data/app/views/kuppayam/workflows/peacock/row.js.erb +24 -0
  72. data/app/views/kuppayam/workflows/peacock/show.js.erb +13 -0
  73. data/app/views/kuppayam/workflows/peacock/update.js.erb +34 -0
  74. data/app/views/layouts/kuppayam/_heading.html.erb +4 -4
  75. data/app/views/layouts/kuppayam/_navbar.html.erb +1 -1
  76. data/app/views/layouts/kuppayam/_overlays.html.erb +7 -0
  77. data/app/views/layouts/kuppayam/_sidebar.html.erb +19 -1
  78. data/app/views/layouts/kuppayam/admin.html.erb +4 -0
  79. data/app/views/layouts/kuppayam/document_upload.html.erb +16 -0
  80. data/app/views/layouts/kuppayam/image_upload.html.erb +16 -0
  81. data/config/initializers/inflections.rb +3 -0
  82. data/config/locales/kuppayam/general.yml +29 -0
  83. data/config/routes.rb +15 -0
  84. data/db/migrate/20170000000000_create_images.rb +13 -0
  85. data/db/migrate/20170000000001_create_documents.rb +13 -0
  86. data/db/migrate/20170000000002_create_import_data.rb +14 -0
  87. data/lib/kuppayam/action_view/form_helper.rb +23 -4
  88. data/lib/kuppayam/action_view/theme_helper.rb +2 -2
  89. data/lib/kuppayam/engine.rb +11 -14
  90. data/lib/kuppayam/version.rb +1 -1
  91. metadata +75 -13
@@ -0,0 +1,20 @@
1
+ class ImportData < Kuppayam::ApplicationRecord
2
+
3
+ # Constants
4
+ PENDING = "pending"
5
+ FAILED = "failed"
6
+ SUCCEEDED = "succeeded"
7
+
8
+ STATUS_HASH = {"Pending" => PENDING, "Failed" => FAILED, "Succeeded" => SUCCEEDED}
9
+ STATUS_HASH_REVERSE = {PENDING => "Pending", FAILED => "Failed", SUCCEEDED => "Succeeded"}
10
+
11
+ # Associations
12
+ has_one :data, :as => :documentable, :dependent => :destroy, :class_name => "Document::ImportData"
13
+ has_one :report, :as => :documentable, :dependent => :destroy, :class_name => "Document::ImportReport"
14
+
15
+ # Validations
16
+ validates :data_type, presence: true
17
+
18
+
19
+
20
+ end
@@ -0,0 +1,5 @@
1
+ module Kuppayam
2
+ class ApplicationRecord < ActiveRecord::Base
3
+ self.abstract_class = true
4
+ end
5
+ end
@@ -0,0 +1,15 @@
1
+ # encoding: utf-8
2
+
3
+ class ImageUploader < CarrierWave::Uploader::Base
4
+
5
+ # Override the directory where uploaded files will be stored.
6
+ # This is a sensible default for uploaders that are meant to be mounted:
7
+ def store_dir
8
+ "uploads/#{Rails.env}/#{model.class.to_s.underscore}/#{model.id}"
9
+ end
10
+
11
+ def cache_dir
12
+ Rails.root.join 'tmp/uploads'
13
+ end
14
+
15
+ end
@@ -0,0 +1,90 @@
1
+ # encoding: utf-8
2
+
3
+ class ImageUploader < CarrierWave::Uploader::Base
4
+
5
+ # Include RMagick or MiniMagick support:
6
+ include CarrierWave::RMagick
7
+ # include CarrierWave::MiniMagick
8
+
9
+ # Choose what kind of storage to use for this uploader:
10
+ # storage Rails.env.production? ? :fog : :file
11
+ # storage :file
12
+
13
+ # Override the directory where uploaded files will be stored.
14
+ # This is a sensible default for uploaders that are meant to be mounted:
15
+ # def store_dir
16
+ # "uploads/#{Rails.env}/#{model.class.to_s.underscore}/#{model.id}"
17
+ # end
18
+
19
+ def cache_dir
20
+ Rails.root.join 'tmp/uploads'
21
+ end
22
+
23
+ #process :crop
24
+
25
+ # version :large do
26
+ # #process :crop
27
+ # #process :resize_to_fit => [60, 60]
28
+ # #process :resize_to_fill => [60, 60]
29
+ # #process :resize_to_limit => [250, 250]
30
+ # process :resize_to_fit => [250, 250]
31
+ # end
32
+
33
+ # version :medium do
34
+ # process :resize_to_fit => [120, 120]
35
+ # end
36
+
37
+ # version :small do
38
+ # process :resize_to_fit => [60, 60]
39
+ # end
40
+
41
+ # version :tiny do
42
+ # process :resize_to_fit => [25, 25]
43
+ # end
44
+
45
+ def crop
46
+ if model.crop_x.present?
47
+ resize_to_limit(540, 540)
48
+ manipulate! do |img|
49
+ x = model.crop_x.to_i
50
+ y = model.crop_y.to_i
51
+ w = model.crop_w.to_i
52
+ h = model.crop_h.to_i
53
+ img.crop!(x, y, w, h)
54
+ end
55
+ end
56
+ end
57
+
58
+ # Provide a default URL as a default if there hasn't been a file uploaded:
59
+ # def default_url
60
+ # # For Rails 3.1+ asset pipeline compatibility:
61
+ # # ActionController::Base.helpers.asset_path("fallback/" + [version_name, "default.png"].compact.join('_'))
62
+ #
63
+ # "/images/fallback/" + [version_name, "default.png"].compact.join('_')
64
+ # end
65
+
66
+ # Process files as they are uploaded:
67
+ # process :scale => [200, 300]
68
+ #
69
+ # def scale(width, height)
70
+ # # do something
71
+ # end
72
+
73
+ # Create different versions of your uploaded files:
74
+ # version :thumb do
75
+ # process :scale => [50, 50]
76
+ # end
77
+
78
+ # Add a white list of extensions which are allowed to be uploaded.
79
+ # For images you might use something like this:
80
+ def extension_white_list
81
+ %w(jpg jpeg png)
82
+ end
83
+
84
+ # Override the filename of the uploaded files:
85
+ # Avoid using model.id or version_name here, see uploader/store.rb for details.
86
+ # def filename
87
+ # "something.jpg" if original_filename
88
+ # end
89
+
90
+ end
@@ -0,0 +1,44 @@
1
+ <%= form_for(@document, :as => :document,
2
+ :url => main_app.crop_document_path(@document),
3
+ :method => :put,
4
+ :html => {:id=>"form_crop_photo", :class=>"mb-0 form-horizontal", :multipart => true, :target => "iframe_crop_photo"}) do |f| %>
5
+
6
+ <div class="modal-body">
7
+
8
+ <%= @document.errors[:base].to_sentence %>
9
+
10
+ <%= hidden_field_tag :documentable_id, params[:documentable_id] %>
11
+ <%= hidden_field_tag :documentable_type, params[:documentable_type] %>
12
+ <%= hidden_field_tag :redirect_url, params[:redirect_url] %>
13
+ <%= hidden_field_tag :document_type, params[:document_type] %>
14
+
15
+ <% %w[x y w h].each do |i| %>
16
+ <%= f.hidden_field "crop_#{i}", class: "crop_#{i}" %>
17
+ <% end %>
18
+
19
+ <div class="add-photos-path">
20
+ <div class="row">
21
+ <%= document_tag @document.document.present? ?
22
+ (@document.document_url) :
23
+ ('http://placehold.it/220x220'), :alt => '', :id => "new_photos", :class=>"img-thumbnail" %>
24
+ </div>
25
+ </div>
26
+
27
+ </div>
28
+
29
+ <div class="modal-footer">
30
+ <div class="pull-right">
31
+ <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
32
+ <%= submit_tag "Crop Document", "data-reset-text"=>"Crop Document", "data-loading-text"=>"Cropping ...", :class=>"btn btn-primary ml-10" %>
33
+ </div>
34
+
35
+ </div>
36
+
37
+ <div class="cl-10"></div>
38
+
39
+ <% end %>
40
+
41
+ <!-- when the form is submitted, the server response will appear in this iframe -->
42
+ <iframe id="iframe_crop_photo" name="iframe_crop_photo" width="100%" style="display:none;">
43
+ </iframe>
44
+
@@ -0,0 +1,47 @@
1
+ <%= form_for(@document, :as => :document,
2
+ :url => (@document.new_record? ? main_app.documents_path : main_app.document_path),
3
+ :method => (@document.new_record? ? :post : :put),
4
+ :html => {:id=>"form_document", :class=>"mb-0 form-horizontal", :multipart => true, :target => "iframe_document"}) do |f| %>
5
+
6
+ <div class="modal-body">
7
+
8
+ <%= @document.errors[:base].to_sentence %>
9
+
10
+ <%= hidden_field_tag :faction, @document.new_record? ? main_app.documents_path : main_app.document_path(@document) %>
11
+
12
+ <%= hidden_field_tag :fmethod, @document.new_record? ? "POST" : "PUT" %>
13
+
14
+ <%= hidden_field_tag :documentable_id, params[:documentable_id] %>
15
+
16
+ <%= hidden_field_tag :documentable_type, params[:documentable_type] %>
17
+
18
+ <%= hidden_field_tag :redirect_url, params[:redirect_url] %>
19
+
20
+ <%= hidden_field_tag :document_type, params[:document_type] %>
21
+
22
+ <div class="add-photos-path">
23
+
24
+ <div class="row">
25
+ <div class="col-md-12">
26
+ <%= theme_form_field(@document, :document, html_options: {type: 'file'}, label: "Upload new Document", param_name: "document") %>
27
+ </div>
28
+ </div>
29
+
30
+ </div>
31
+
32
+ </div>
33
+
34
+ <div class="modal-footer">
35
+ <div class="pull-right">
36
+ <% button_text = "#{@document.new_record? ? "Create" : "Update"} Photo" %>
37
+
38
+ <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
39
+
40
+ <%= submit_tag button_text, "data-reset-text"=>button_text, "data-loading-text"=>"Saving ...", :class=>"btn btn-primary ml-10" %>
41
+ </div>
42
+
43
+ </div>
44
+
45
+ <div class="cl-10"></div>
46
+
47
+ <% end %>
@@ -0,0 +1,9 @@
1
+
2
+ <%# Used to create a new photo form %>
3
+ <div class="box p-10">
4
+ <div class="p-10 text-color-blue fs-18 mb-20">
5
+ Add a Picture
6
+ </div>
7
+ <%= render 'form' %>
8
+ </div>
9
+
@@ -0,0 +1,16 @@
1
+ <% if photo_album.photos.any? %>
2
+
3
+ <div id="links">
4
+ <% photo_album.photos.each do |photo| %>
5
+ <a class="" href="<%= photo.document_url %>"
6
+ title="<%= photo_album.name%>" data-gallery="">
7
+ <%= display_photo(photo, 200) %>
8
+ </a>
9
+ <% end %>
10
+ </div>
11
+
12
+ <% else %>
13
+ <p>Photos are not available yet. Please upload photos</p>
14
+ <% end %>
15
+
16
+
@@ -0,0 +1,14 @@
1
+ <%= content_for :javascript_footer do %>
2
+ <script type="text/javascript">
3
+ this.parent.closeGenericModal();
4
+
5
+ //var heading = "Crop Document";
6
+ //var bodyContent = "<%#= escape_javascript(render(:partial=>"crop_form")) %>";
7
+ //this.parent.showModal(heading, bodyContent);
8
+ //this.parent.cropDocument("form_crop_photo");
9
+
10
+ this.parent.$(".<%= @resource.id %>-large-document").attr("src", "<%= @document.document.large.url %>");
11
+ this.parent.$(".<%= @resource.id %>-small-document").attr("src", "<%= @document.document.small.url %>");
12
+
13
+ </script>
14
+ <% end %>
@@ -0,0 +1,9 @@
1
+ <%= content_for :javascript_footer do %>
2
+ <script type="text/javascript">
3
+ this.parent.closeGenericModal();
4
+
5
+ this.parent.$(".<%= @resource.id %>-large-document").attr("src", "<%= @document.document.large.url %>");
6
+ this.parent.$(".<%= @resource.id %>-small-document").attr("src", "<%= @document.document.small.url %>");
7
+
8
+ </script>
9
+ <% end %>
@@ -0,0 +1,7 @@
1
+ // Show the new form in the right box.
2
+ heading = "Upload Document";
3
+ bodyContent = "<%= escape_javascript(render(:partial=>'form')) %>";
4
+ showGenericModal(heading, bodyContent);
5
+
6
+ // When the document upload form is submitted, the server response will appear in this iframe -->
7
+ var $div = $('<iframe id="iframe_document" name="iframe_document" width="100%" style="display:none"></iframe>').appendTo('body');
@@ -0,0 +1,7 @@
1
+ // Show the new form in the right box.
2
+ heading = "Upload Document";
3
+ bodyContent = "<%= escape_javascript(render(:partial=>'form')) %>";
4
+ showGenericModal(heading, bodyContent);
5
+
6
+ // When the document upload form is submitted, the server response will appear in this iframe -->
7
+ var $div = $('<iframe id="iframe_document" name="iframe_document" width="100%" style="display:none"></iframe>').appendTo('body');
@@ -0,0 +1,14 @@
1
+ <%= content_for :javascript_footer do %>
2
+ <script type="text/javascript">
3
+ this.parent.closeGenericModal();
4
+
5
+ // var heading = "Crop Document";
6
+ // var bodyContent = "<%#= escape_javascript(render(:partial=>'crop_form')) %>";
7
+ // this.parent.showGenericModal(heading, bodyContent);
8
+ // this.parent.cropDocument("form_crop_photo");
9
+
10
+ this.parent.$(".<%= @resource.id %>-large-document").attr("src", "<%= @document.document.large.url %>");
11
+ this.parent.$(".<%= @resource.id %>-small-document").attr("src", "<%= @document.document.small.url %>");
12
+
13
+ </script>
14
+ <% end %>
@@ -0,0 +1,14 @@
1
+ <div class="row">
2
+ <div class="col-md-4">
3
+ </div>
4
+ <div class="col-md-8">
5
+ <%= search_form_kuppayam(Image::Base, images_path, text: @filters[:query]) %>
6
+ </div>
7
+ </div>
8
+
9
+
10
+
11
+
12
+
13
+
14
+
@@ -0,0 +1,44 @@
1
+ <%= form_for(@image, :as => :image,
2
+ :url => main_app.crop_image_path(@image),
3
+ :method => :put,
4
+ :html => {:id=>"form_crop_photo", :class=>"mb-0 form-horizontal", :multipart => true, :target => "iframe_crop_photo"}) do |f| %>
5
+
6
+ <div class="modal-body">
7
+
8
+ <%= @image.errors[:base].to_sentence %>
9
+
10
+ <%= hidden_field_tag :imageable_id, params[:imageable_id] %>
11
+ <%= hidden_field_tag :imageable_type, params[:imageable_type] %>
12
+ <%= hidden_field_tag :redirect_url, params[:redirect_url] %>
13
+ <%= hidden_field_tag :image_type, params[:image_type] %>
14
+
15
+ <% %w[x y w h].each do |i| %>
16
+ <%= f.hidden_field "crop_#{i}", class: "crop_#{i}" %>
17
+ <% end %>
18
+
19
+ <div class="add-photos-path">
20
+ <div class="row">
21
+ <%= image_tag @image.image.present? ?
22
+ (@image.image_url) :
23
+ ('http://placehold.it/220x220'), :alt => '', :id => "new_photos", :class=>"img-thumbnail" %>
24
+ </div>
25
+ </div>
26
+
27
+ </div>
28
+
29
+ <div class="modal-footer">
30
+ <div class="pull-right">
31
+ <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
32
+ <%= submit_tag "Crop Image", "data-reset-text"=>"Crop Image", "data-loading-text"=>"Cropping ...", :class=>"btn btn-primary ml-10" %>
33
+ </div>
34
+
35
+ </div>
36
+
37
+ <div class="cl-10"></div>
38
+
39
+ <% end %>
40
+
41
+ <!-- when the form is submitted, the server response will appear in this iframe -->
42
+ <iframe id="iframe_crop_photo" name="iframe_crop_photo" width="100%" style="display:none;">
43
+ </iframe>
44
+
@@ -0,0 +1,56 @@
1
+ <%= form_for(@image, :as => :image,
2
+ :url => (@image.new_record? ? main_app.images_path : main_app.image_path),
3
+ :method => (@image.new_record? ? :post : :put),
4
+ :html => {:id=>"form_image", :class=>"mb-0 form-horizontal", :multipart => true, :target => "iframe_image"}) do |f| %>
5
+
6
+ <div class="modal-body">
7
+
8
+ <div id="image_form_error">
9
+ <%= @image.errors[:base].to_sentence %>
10
+ </div>
11
+
12
+ <% begin %>
13
+ <% if @image_type %>
14
+
15
+ <blockquote class="blockquote blockquote-red">
16
+ <p><strong><i class="linecons-lightbulb"></i> Please read the instructions below:</strong></p>
17
+
18
+ <ul>
19
+ <%= eval("#{@image_type}::INSTRUCTIONS").each do |i| %>
20
+ <li><%= raw i %></li>
21
+ <% end %>
22
+ </ul>
23
+ </blockquote>
24
+
25
+ <% end %>
26
+ <% rescue %>
27
+ <% end %>
28
+
29
+ <%= hidden_field_tag :faction, @image.new_record? ? main_app.images_path : main_app.image_path(@image) %>
30
+
31
+ <%= hidden_field_tag :fmethod, @image.new_record? ? "POST" : "PUT" %>
32
+
33
+ <%= hidden_field_tag :imageable_id, params[:imageable_id] %>
34
+
35
+ <%= hidden_field_tag :imageable_type, params[:imageable_type] %>
36
+
37
+ <%= hidden_field_tag :redirect_url, params[:redirect_url] %>
38
+
39
+ <%= hidden_field_tag :image_type, params[:image_type] %>
40
+
41
+ <%= theme_form_field(@image, :image, html_options: {type: 'file'}, label: "Upload new Image", param_name: "image") %>
42
+
43
+ </div>
44
+
45
+ <div class="modal-footer">
46
+ <div class="pull-right">
47
+ <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
48
+
49
+ <%= submit_tag "Upload", "data-reset-text"=>"Upload", "data-loading-text"=>"Uploading ...", :class=>"btn btn-primary ml-10" %>
50
+ </div>
51
+
52
+ </div>
53
+
54
+ <div class="cl-10"></div>
55
+
56
+ <% end %>
@@ -0,0 +1,49 @@
1
+ <div class="table-responsive">
2
+ <table class="table table-hover members-table middle-align">
3
+ <thead>
4
+ <tr>
5
+ <th style="text-align: center;width:30px">#</th>
6
+ <th>Name</th>
7
+ <th>Image Type</th>
8
+ <th>Imageable</th>
9
+ <th>Original</th>
10
+ <th style="text-align: center;">Actions</th>
11
+ </tr>
12
+ </thead>
13
+ <tbody>
14
+ <% @images.each_with_index do |image, i| %>
15
+
16
+ <% edit_link = edit_image_path(id: image.id) %>
17
+ <% delete_link = image_path(id: image.id) %>
18
+
19
+ <tr id="tr_image_<%= image.id %>">
20
+
21
+ <td class="image-image">
22
+ <%= link_to(image_path(image), remote: true) do %>
23
+ <%= display_image(image, "small.url", width: "40", height: "auto", class: "img-rectangle", alt: image.display_name) %>
24
+ <% end %>
25
+ </td>
26
+
27
+ <td class="image-name"><%= link_to (image.imageable.try(:display_name) || "#{image.imageable_id} - #{image.imageable_type}" ), image_path(image), remote: true %></td>
28
+
29
+ <td class="image-name"><%= link_to image.class.name, image_path(image), remote: true %></td>
30
+
31
+ <td class="action-links" style="width:10%">
32
+
33
+ <%= link_to raw("<i class=\"linecons-pencil\"></i> Edit Image"), edit_link, :remote=>true, class: "edit" %>
34
+
35
+ <%= link_to raw("<i class=\"linecons-trash\"></i> Delete"), delete_link, method: :delete, role: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "delete" %>
36
+
37
+ </td>
38
+
39
+ </tr>
40
+ <% end %>
41
+ </tbody>
42
+ </table>
43
+ </div>
44
+
45
+ <div class="row">
46
+ <div class="col-sm-12">
47
+ <%= paginate_kuppayam(@images) %>
48
+ </div>
49
+ </div>
@@ -0,0 +1,9 @@
1
+
2
+ <%# Used to create a new photo form %>
3
+ <div class="box p-10">
4
+ <div class="p-10 text-color-blue fs-18 mb-20">
5
+ Add a Picture
6
+ </div>
7
+ <%= render 'form' %>
8
+ </div>
9
+
@@ -0,0 +1,16 @@
1
+ <% if photo_album.photos.any? %>
2
+
3
+ <div id="links">
4
+ <% photo_album.photos.each do |photo| %>
5
+ <a class="" href="<%= photo.image_url %>"
6
+ title="<%= photo_album.name%>" data-gallery="">
7
+ <%= display_photo(photo, 200) %>
8
+ </a>
9
+ <% end %>
10
+ </div>
11
+
12
+ <% else %>
13
+ <p>Photos are not available yet. Please upload photos</p>
14
+ <% end %>
15
+
16
+
@@ -0,0 +1,65 @@
1
+ <% edit_link = edit_event_path(id: event.id) %>
2
+ <% delete_link = event_path(id: event.id) %>
3
+
4
+ <tr id="tr_event_<%= event.id %>">
5
+
6
+ <td class="event-image">
7
+ <%= link_to(event_path(event), remote: true) do %>
8
+ <%= display_image(event, "cover_image.image.small.url", width: "120", height: "auto", class: "img-rectangle", alt: event.display_name) %>
9
+ <% end %>
10
+ </td>
11
+
12
+ <td class="event-name"><%= link_to event.title, event_path(event), remote: true %></td>
13
+
14
+ <td class="event-name"><%= link_to event.venue, event_path(event), remote: true %></td>
15
+
16
+ <td>
17
+ <% if event.featured %>
18
+ <span class="ml-5 mt-5 label label-warning">Featured</span>
19
+ <% end %>
20
+ </td>
21
+
22
+ <td>
23
+ <% status_hash = {published: "success", unpublished: "info", removed: "danger", archived: "default"} %>
24
+ <span class="ml-5 mt-5 label label-<%= status_hash[event.status] %>"><%= event.display_status %></span>
25
+ </td>
26
+
27
+ <td class="action-links" style="width:10%">
28
+
29
+ <% case event.status %>
30
+ <% when "published" %>
31
+ <!-- Un-Publish -->
32
+ <%= link_to raw("<i class=\"fa fa-circle mr-5\"></i> Un-Publish"), update_status_event_path(:id =>event.id, :status =>'unpublished'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1", :class=>"event_status" %>
33
+
34
+ <!-- Remove -->
35
+ <%= link_to raw("<i class=\"fa fa-edit mr-5\"></i> Remove"), update_status_event_path(:id =>event.id, :status =>'removed'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1", :class=>"event_status" %>
36
+
37
+ <!-- Archive -->
38
+ <%= link_to raw("<i class=\"fa fa-edit mr-5\"></i> Archive"), update_status_event_path(:id =>event.id, :status =>'archived'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1", :class=>"event_status" %>
39
+ <% when "unpublished" %>
40
+ <!-- Approve -->
41
+ <%= link_to raw("<i class=\"fa fa-circle-o mr-5\"></i> Publish"), update_status_event_path(:id =>event.id, :status =>'published'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1", :class=>"event_status" %>
42
+ <!-- Remove -->
43
+ <%= link_to raw("<i class=\"fa fa-edit mr-5\"></i> Remove"), update_status_event_path(:id =>event.id, :status =>'removed'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1", :class=>"event_status" %>
44
+ <!-- Archive -->
45
+ <%= link_to raw("<i class=\"fa fa-edit mr-5\"></i> Archive"), update_status_event_path(:id =>event.id, :status =>'archived'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1", :class=>"event_status" %>
46
+ <% when "removed", "archived" %>
47
+ <!-- Un-Publish -->
48
+ <%= link_to raw("<i class=\"fa fa-circle mr-5\"></i> Un-Publish"), update_status_event_path(:id =>event.id, :status =>'unpublished'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1", :class=>"event_status" %>
49
+ <!-- Approve -->
50
+ <%= link_to raw("<i class=\"fa fa-circle-o mr-5\"></i> Publish"), update_status_event_path(:id =>event.id, :status =>'published'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1",:class=>"event_status" %>
51
+ <!-- Archive -->
52
+ <%= link_to raw("<i class=\"fa fa-edit mr-5\"></i> Archive"), update_status_event_path(:id =>event.id, :status =>'archived'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1", :class=>"event_status" %>
53
+ <% end %>
54
+
55
+ </td>
56
+
57
+ <td class="action-links" style="width:10%">
58
+
59
+ <%= link_to raw("<i class=\"linecons-pencil\"></i> Edit Event"), edit_link, :remote=>true, class: "edit" %>
60
+
61
+ <%= link_to raw("<i class=\"linecons-trash\"></i> Delete"), delete_link, method: :delete, role: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "delete" %>
62
+
63
+ </td>
64
+
65
+ </tr>
@@ -0,0 +1,38 @@
1
+ <%= content_for :javascript_footer do %>
2
+ <script type="text/javascript">
3
+
4
+ <% if @image.errors.any? %>
5
+
6
+ <% if @image_type %>
7
+ var heading = "Add <%= @image_type.class.name.titleize %>";
8
+ <% else %>
9
+ var heading = "Add Image";
10
+ <% end %>
11
+
12
+ var bodyContent = "<%= escape_javascript(render(:partial=>'form')) %>";
13
+
14
+ this.parent.showGenericModal(heading, bodyContent);
15
+
16
+ <%
17
+ text = "You have few errors. They have been highlighted."
18
+ error_message = content_tag(:div, text, class: "alert alert-danger")
19
+ %>
20
+
21
+ this.parent.$("#image_form_error").html("<%= escape_javascript(error_message) %>");
22
+
23
+ <% else %>
24
+
25
+ this.parent.closeGenericModal();
26
+
27
+ //var heading = "Crop Image";
28
+ //var bodyContent = "<%#= escape_javascript(render(:partial=>"crop_form")) %>";
29
+ //this.parent.showModal(heading, bodyContent);
30
+ //this.parent.cropImage("form_crop_photo");
31
+
32
+ this.parent.$(".<%= @resource.id %>-large-image").attr("src", "<%= @image.image.large.url %>");
33
+ this.parent.$(".<%= @resource.id %>-small-image").attr("src", "<%= @image.image.small.url %>");
34
+
35
+ <% end %>
36
+
37
+ </script>
38
+ <% end %>
@@ -0,0 +1,9 @@
1
+ <%= content_for :javascript_footer do %>
2
+ <script type="text/javascript">
3
+ this.parent.closeGenericModal();
4
+
5
+ this.parent.$(".<%= @resource.id %>-large-image").attr("src", "<%= @image.image.large.url %>");
6
+ this.parent.$(".<%= @resource.id %>-small-image").attr("src", "<%= @image.image.small.url %>");
7
+
8
+ </script>
9
+ <% end %>
@@ -0,0 +1,8 @@
1
+ <% if @image_type %>
2
+ heading = "Edit <%= @image_type.split('::').last.titleize %>";
3
+ <% else %>
4
+ heading = "Edit Image";
5
+ <% end %>
6
+
7
+ bodyContent = "<%= escape_javascript(render(:partial=>'form')) %>";
8
+ showGenericModal(heading, bodyContent);