kuppayam 0.1.5 → 0.1.6dev2
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 +4 -4
- data/README.md +13 -0
- data/app/assets/images/{kuppayam/favicon.png → favicon.png} +0 -0
- data/app/assets/images/{kuppayam/logo.png → logo.png} +0 -0
- data/app/assets/javascripts/kuppayam.js +3 -0
- data/app/assets/javascripts/kuppayam/utilities.js +28 -0
- data/app/assets/stylesheets/kuppayam.css +1 -0
- data/app/assets/stylesheets/kuppayam/custom.css +4 -0
- data/app/controllers/kuppayam/base_controller.rb +14 -4
- data/app/controllers/kuppayam/documents_controller.rb +24 -0
- data/app/controllers/kuppayam/images_controller.rb +41 -1
- data/app/helpers/breadcrumbs_helper.rb +1 -1
- data/app/helpers/filter_helper.rb +9 -3
- data/app/helpers/image_helper.rb +11 -3
- data/app/helpers/kuppayam_helper.rb +2 -2
- data/app/helpers/meta_tags_helper.rb +0 -4
- data/app/helpers/notification_helper.rb +6 -6
- data/app/helpers/render_helper.rb +11 -2
- data/app/helpers/resource_helper.rb +23 -9
- data/app/models/document/base.rb +13 -15
- data/app/models/document/import_data_file.rb +14 -0
- data/app/models/document/import_report_file.rb +8 -0
- data/app/models/image/base.rb +12 -14
- data/app/models/import_data.rb +19 -2
- data/app/models/kuppayam/application_record.rb +3 -0
- data/app/uploaders/document_uploader.rb +4 -4
- data/app/uploaders/image_uploader.rb +1 -1
- data/app/uploaders/import_data_uploader.rb +15 -0
- data/app/views/kuppayam/documents/create.html.erb +1 -1
- data/app/views/kuppayam/documents/edit.js.erb +1 -1
- data/app/views/kuppayam/documents/new.js.erb +1 -1
- data/app/views/kuppayam/documents/update.html.erb +1 -1
- data/app/views/kuppayam/filters/_display_dropdown_filters.html.erb +11 -0
- data/app/views/kuppayam/filters/_display_filters.html.erb +29 -0
- data/app/views/kuppayam/http_status/404.html.erb +1 -0
- data/app/views/kuppayam/images/_form.html.erb +1 -1
- data/app/views/kuppayam/images/_index.html.erb +17 -20
- data/app/views/kuppayam/images/_show.html.erb +32 -0
- data/app/views/kuppayam/images/create.html.erb +4 -4
- data/app/views/kuppayam/images/crop.html.erb +1 -1
- data/app/views/kuppayam/images/destroy.js.erb +19 -0
- data/app/views/kuppayam/images/edit.js.erb +3 -3
- data/app/views/kuppayam/images/index.html.erb +8 -1
- data/app/views/kuppayam/images/new.js.erb +1 -1
- data/app/views/kuppayam/images/update.html.erb +5 -5
- data/app/views/kuppayam/import_data/new.js.erb +1 -1
- data/app/views/kuppayam/import_data/update.html.erb +1 -1
- data/app/views/kuppayam/workflows/parrot/create.js.erb +11 -6
- data/app/views/kuppayam/workflows/parrot/edit.js.erb +1 -1
- data/app/views/kuppayam/workflows/parrot/new.js.erb +2 -2
- data/app/views/kuppayam/workflows/parrot/row.js.erb +1 -1
- data/app/views/kuppayam/workflows/parrot/update.js.erb +10 -5
- data/app/views/kuppayam/workflows/peacock/create.js.erb +12 -7
- data/app/views/kuppayam/workflows/peacock/edit.js.erb +2 -2
- data/app/views/kuppayam/workflows/peacock/new.js.erb +2 -2
- data/app/views/kuppayam/workflows/peacock/row.js.erb +1 -1
- data/app/views/kuppayam/workflows/peacock/update.js.erb +11 -6
- data/app/views/layouts/kuppayam/_footer.html.erb +1 -0
- data/app/views/layouts/kuppayam/_head.html.erb +11 -2
- data/app/views/layouts/kuppayam/_heading.html.erb +11 -2
- data/app/views/layouts/kuppayam/_horizontal_menu.html.erb +932 -0
- data/app/views/layouts/kuppayam/_sidebar.html.erb +5 -2
- data/app/views/layouts/kuppayam/admin.html.erb +63 -6
- data/app/views/layouts/kuppayam/blank.html.erb +62 -5
- data/app/views/layouts/kuppayam/document_upload.html.erb +3 -2
- data/app/views/layouts/kuppayam/image_upload.html.erb +3 -2
- data/app/views/layouts/kuppayam/layout_horizontal_menu.html.erb +116 -0
- data/app/views/layouts/kuppayam/print_a4.html.erb +32 -0
- data/app/views/layouts/kuppayam/user.html.erb +120 -0
- data/config/initializers/importer.rb +303 -0
- data/config/initializers/validators.rb +78 -0
- data/config/locales/kuppayam/general.yml +1 -0
- data/config/routes.rb +1 -1
- data/db/migrate/20170000000000_create_images.rb +1 -0
- data/db/migrate/20170000000001_create_documents.rb +2 -1
- data/db/migrate/20170000000002_create_import_data.rb +2 -2
- data/lib/kuppayam/action_view/form_helper.rb +1 -1
- data/lib/kuppayam/action_view/theme_helper.rb +8 -2
- data/lib/kuppayam/engine.rb +2 -0
- data/lib/kuppayam/version.rb +1 -1
- data/lib/tasks/template.rake +72 -0
- data/lib/tasks/test_import.rake +40 -0
- data/vendor/assets/stylesheets/custom.css +0 -0
- metadata +76 -16
- data/app/views/kuppayam/images/_action_buttons.html.erb +0 -14
- data/app/views/layouts/kuppayam/_overlays.html.erb +0 -47
- data/config/initializers/kuppayam_validators.rb +0 -76
- data/lib/tasks/kuppayam_tasks.rake +0 -4
data/app/models/document/base.rb
CHANGED
|
@@ -1,14 +1,21 @@
|
|
|
1
|
+
require 'filesize'
|
|
2
|
+
|
|
1
3
|
class Document::Base < Kuppayam::ApplicationRecord
|
|
2
4
|
|
|
3
5
|
# Constants
|
|
4
|
-
UPLOAD_LIMIT =
|
|
6
|
+
UPLOAD_LIMIT = 5242880 # this is in bytes which is equivalent to 5 megabytes
|
|
7
|
+
|
|
8
|
+
INSTRUCTIONS = [
|
|
9
|
+
"<Override this instructions in your document class>"
|
|
10
|
+
]
|
|
5
11
|
|
|
6
12
|
self.table_name = "documents"
|
|
7
|
-
self.inheritance_column = :
|
|
13
|
+
self.inheritance_column = :document_type
|
|
8
14
|
|
|
9
15
|
# Validations
|
|
10
16
|
validates :document, :presence => true
|
|
11
|
-
|
|
17
|
+
validates :documentable, :presence => true
|
|
18
|
+
validate :check_file_size
|
|
12
19
|
|
|
13
20
|
# Associations
|
|
14
21
|
belongs_to :documentable, :polymorphic => true, optional: true
|
|
@@ -17,22 +24,13 @@ class Document::Base < Kuppayam::ApplicationRecord
|
|
|
17
24
|
# Class Methods
|
|
18
25
|
# ------------------
|
|
19
26
|
|
|
20
|
-
# return an published record relation object with the search query in its where clause
|
|
21
|
-
# Return the ActiveRecord::Relation object
|
|
22
|
-
# == Examples
|
|
23
|
-
# >>> document.search(query)
|
|
24
|
-
# => ActiveRecord::Relation object
|
|
25
|
-
scope :search, lambda { |query| where("LOWER(imageable_type) LIKE LOWER('%#{query}%') OR\
|
|
26
|
-
LOWER(imageable_id) LIKE LOWER('%#{query}%')")
|
|
27
|
-
}
|
|
28
|
-
|
|
29
27
|
# ------------------
|
|
30
28
|
# Instance Methods
|
|
31
29
|
# ------------------
|
|
32
30
|
|
|
33
|
-
def
|
|
34
|
-
if document && document.file && document.file.size.to_f > UPLOAD_LIMIT
|
|
35
|
-
errors.add(:document, "You cannot upload a document greater than #{UPLOAD_LIMIT.
|
|
31
|
+
def check_file_size
|
|
32
|
+
if document && document.file && document.file.size.to_f > self.class::UPLOAD_LIMIT
|
|
33
|
+
errors.add(:document, "You cannot upload a document greater than #{Filesize.from(self.class::UPLOAD_LIMIT.to_s+ " b").pretty}")
|
|
36
34
|
end
|
|
37
35
|
end
|
|
38
36
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
class Document::ImportDataFile < Document::Base
|
|
2
|
+
|
|
3
|
+
# Constants
|
|
4
|
+
UPLOAD_LIMIT = 12582912 # this is in bytes which is equivalent to 12 megabytes
|
|
5
|
+
|
|
6
|
+
INSTRUCTIONS = [
|
|
7
|
+
"the filename should be in in CSV/XLS/XLSX format",
|
|
8
|
+
"the column structure should be exactly the same as mentioned. To make sure that you are following the structure, download the sample data and inspect it.",
|
|
9
|
+
"the file size should not exceed <strong>10 Mb</strong>. In case if your file is big, split them into multiple files."
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
mount_uploader :document, DocumentUploader
|
|
13
|
+
|
|
14
|
+
end
|
data/app/models/image/base.rb
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
class Image::Base < Kuppayam::ApplicationRecord
|
|
2
2
|
|
|
3
3
|
# Constants
|
|
4
|
-
UPLOAD_LIMIT = 1
|
|
4
|
+
UPLOAD_LIMIT = 1048576 # this is in bytes which is equivalent to 1 megabyte
|
|
5
|
+
|
|
6
|
+
INSTRUCTIONS = [
|
|
7
|
+
"the filename should be in .jpg / .jpeg or .png format",
|
|
8
|
+
"the image dimensions are smaller than <strong>750 x 368 Pixels</strong>, (Portrait Format). (most cameras and camera phones will produce images bigger than this)",
|
|
9
|
+
"the file size is less than 20 Kb, or bigger than <strong>1 MB</strong>"
|
|
10
|
+
]
|
|
5
11
|
|
|
6
12
|
self.table_name = "images"
|
|
7
13
|
self.inheritance_column = :image_type
|
|
@@ -10,7 +16,8 @@ class Image::Base < Kuppayam::ApplicationRecord
|
|
|
10
16
|
|
|
11
17
|
# Validations
|
|
12
18
|
validates :image, :presence => true
|
|
13
|
-
|
|
19
|
+
validates :imageable, :presence => true
|
|
20
|
+
validate :check_file_size
|
|
14
21
|
|
|
15
22
|
# Associations
|
|
16
23
|
belongs_to :imageable, :polymorphic => true #, optional: false
|
|
@@ -22,15 +29,6 @@ class Image::Base < Kuppayam::ApplicationRecord
|
|
|
22
29
|
# Class Methods
|
|
23
30
|
# ------------------
|
|
24
31
|
|
|
25
|
-
# return an published record relation object with the search query in its where clause
|
|
26
|
-
# Return the ActiveRecord::Relation object
|
|
27
|
-
# == Examples
|
|
28
|
-
# >>> image.search(query)
|
|
29
|
-
# => ActiveRecord::Relation object
|
|
30
|
-
scope :search, lambda { |query| where("LOWER(imageable_type) LIKE LOWER('%#{query}%') OR\
|
|
31
|
-
LOWER(imageable_id) LIKE LOWER('%#{query}%')")
|
|
32
|
-
}
|
|
33
|
-
|
|
34
32
|
# ------------------
|
|
35
33
|
# Instance Methods
|
|
36
34
|
# ------------------
|
|
@@ -39,9 +37,9 @@ class Image::Base < Kuppayam::ApplicationRecord
|
|
|
39
37
|
image.recreate_versions! if crop_x.present?
|
|
40
38
|
end
|
|
41
39
|
|
|
42
|
-
def
|
|
43
|
-
if image && image.file && image.file.size.to_f > UPLOAD_LIMIT
|
|
44
|
-
errors.add(:image, "You cannot upload an image greater than #{UPLOAD_LIMIT.
|
|
40
|
+
def check_file_size
|
|
41
|
+
if image && image.file && image.file.size.to_f > self.class::UPLOAD_LIMIT
|
|
42
|
+
errors.add(:image, "You cannot upload an image greater than #{Filesize.from(self.class::UPLOAD_LIMIT.to_s+ " b").pretty}")
|
|
45
43
|
end
|
|
46
44
|
end
|
|
47
45
|
|
data/app/models/import_data.rb
CHANGED
|
@@ -9,12 +9,29 @@ class ImportData < Kuppayam::ApplicationRecord
|
|
|
9
9
|
STATUS_HASH_REVERSE = {PENDING => "Pending", FAILED => "Failed", SUCCEEDED => "Succeeded"}
|
|
10
10
|
|
|
11
11
|
# Associations
|
|
12
|
-
|
|
13
|
-
has_one :
|
|
12
|
+
belongs_to :importable, :polymorphic => true #, optional: false
|
|
13
|
+
has_one :data, :as => :documentable, :dependent => :destroy, :class_name => "Document::ImportDataFile"
|
|
14
|
+
has_one :report, :as => :documentable, :dependent => :destroy, :class_name => "Document::ImportReportFile"
|
|
14
15
|
|
|
15
16
|
# Validations
|
|
17
|
+
validates :importable, presence: true
|
|
16
18
|
validates :data_type, presence: true
|
|
17
19
|
|
|
20
|
+
# ------------------
|
|
21
|
+
# Class Methods
|
|
22
|
+
# ------------------
|
|
23
|
+
|
|
24
|
+
# ------------------
|
|
25
|
+
# Instance Methods
|
|
26
|
+
# ------------------
|
|
27
|
+
|
|
28
|
+
def display_name
|
|
29
|
+
if self.importable
|
|
30
|
+
"#{self.id} - Import Data for #{self.importable.display_name}"
|
|
31
|
+
else
|
|
32
|
+
"#{self.id} - Import Data (No Importable)"
|
|
33
|
+
end
|
|
34
|
+
end
|
|
18
35
|
|
|
19
36
|
|
|
20
37
|
end
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
2
|
|
|
3
|
-
class
|
|
3
|
+
class DocumentUploader < CarrierWave::Uploader::Base
|
|
4
4
|
|
|
5
5
|
# Override the directory where uploaded files will be stored.
|
|
6
6
|
# This is a sensible default for uploaders that are meant to be mounted:
|
|
7
7
|
def store_dir
|
|
8
|
-
|
|
8
|
+
"#{Rails.root}/uploads/#{model.class.to_s.underscore}/#{model.id}"
|
|
9
9
|
end
|
|
10
|
-
|
|
10
|
+
|
|
11
11
|
def cache_dir
|
|
12
|
-
|
|
12
|
+
Rails.root.join 'tmp/uploads'
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
class ImportDataUploader < 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
|
+
"#{Rails.root}/uploads/import_data/#{model.id}"
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def cache_dir
|
|
12
|
+
Rails.root.join 'tmp/import_data'
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<%= content_for :javascript_footer do %>
|
|
2
2
|
<script type="text/javascript">
|
|
3
|
-
this.parent.
|
|
3
|
+
this.parent.closeDocumentUploadModal();
|
|
4
4
|
|
|
5
5
|
//var heading = "Crop Document";
|
|
6
6
|
//var bodyContent = "<%#= escape_javascript(render(:partial=>"crop_form")) %>";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Show the new form in the right box.
|
|
2
2
|
heading = "Upload Document";
|
|
3
3
|
bodyContent = "<%= escape_javascript(render(:partial=>'form')) %>";
|
|
4
|
-
showGenericModal(heading, bodyContent);
|
|
4
|
+
showGenericModal(heading, bodyContent, true);
|
|
5
5
|
|
|
6
6
|
// When the document upload form is submitted, the server response will appear in this iframe -->
|
|
7
7
|
var $div = $('<iframe id="iframe_document" name="iframe_document" width="100%" style="display:none"></iframe>').appendTo('body');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Show the new form in the right box.
|
|
2
2
|
heading = "Upload Document";
|
|
3
3
|
bodyContent = "<%= escape_javascript(render(:partial=>'form')) %>";
|
|
4
|
-
showGenericModal(heading, bodyContent);
|
|
4
|
+
showGenericModal(heading, bodyContent, true);
|
|
5
5
|
|
|
6
6
|
// When the document upload form is submitted, the server response will appear in this iframe -->
|
|
7
7
|
var $div = $('<iframe id="iframe_document" name="iframe_document" width="100%" style="display:none"></iframe>').appendTo('body');
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
// var heading = "Crop Document";
|
|
6
6
|
// var bodyContent = "<%#= escape_javascript(render(:partial=>'crop_form')) %>";
|
|
7
|
-
// this.parent.showGenericModal(heading, bodyContent);
|
|
7
|
+
// this.parent.showGenericModal(heading, bodyContent, true);
|
|
8
8
|
// this.parent.cropDocument("form_crop_photo");
|
|
9
9
|
|
|
10
10
|
this.parent.$(".<%= @resource.id %>-large-document").attr("src", "<%= @document.document.large.url %>");
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<div class="row" id="div_kuppayam_report_filters">
|
|
2
|
+
<div class="col-md-12">
|
|
3
|
+
<% @filter_ui_settings.each do |filter_name, options| %>
|
|
4
|
+
<% if options[:object_filter] == true %>
|
|
5
|
+
<%= report_object_filter(filter_name, options) %>
|
|
6
|
+
<% else %>
|
|
7
|
+
<%= report_filter(filter_name, options) %>
|
|
8
|
+
<% end %>
|
|
9
|
+
<% end %>
|
|
10
|
+
</div>
|
|
11
|
+
</div>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<div class="mb-20" style="font-size:16px; color: darkred; text-align: left;">Selected Filters</div>
|
|
2
|
+
|
|
3
|
+
<div class="table-responsive table-scrollable">
|
|
4
|
+
<table class="table table-striped table-condensed table-bordered">
|
|
5
|
+
<tbody>
|
|
6
|
+
<tr>
|
|
7
|
+
<% @filters.each do |name, value| %>
|
|
8
|
+
<th style="text-align: left;"><%= name.to_s.titleize %></th>
|
|
9
|
+
<% end %>
|
|
10
|
+
</tr>
|
|
11
|
+
<tr>
|
|
12
|
+
<% @filters.each do |name, value| %>
|
|
13
|
+
<%
|
|
14
|
+
display = case value
|
|
15
|
+
when ActiveRecord::Base
|
|
16
|
+
value.display_name
|
|
17
|
+
when "null", nil
|
|
18
|
+
"IS NULL"
|
|
19
|
+
else
|
|
20
|
+
value.to_s.titleize
|
|
21
|
+
end
|
|
22
|
+
#display = value.is_a?(ActiveRecord::Base) ? value.display_name : value.to_s
|
|
23
|
+
%>
|
|
24
|
+
<td style="text-align: left;"><%= display %></td>
|
|
25
|
+
<% end %>
|
|
26
|
+
</tr>
|
|
27
|
+
</tbody>
|
|
28
|
+
</table>
|
|
29
|
+
</div>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Temporary
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
<p><strong><i class="linecons-lightbulb"></i> Please read the instructions below:</strong></p>
|
|
17
17
|
|
|
18
18
|
<ul>
|
|
19
|
-
|
|
19
|
+
<% eval("#{@image_type}::INSTRUCTIONS").each do |i| %>
|
|
20
20
|
<li><%= raw i %></li>
|
|
21
21
|
<% end %>
|
|
22
22
|
</ul>
|
|
@@ -5,36 +5,33 @@
|
|
|
5
5
|
<th style="text-align: center;width:30px">#</th>
|
|
6
6
|
<th>Name</th>
|
|
7
7
|
<th>Image Type</th>
|
|
8
|
-
<th>Imageable</th>
|
|
9
|
-
<th>Original</th>
|
|
10
|
-
<th style="text-align: center;">Actions</th>
|
|
8
|
+
<th style="text-align: center;">Imageable</th>
|
|
11
9
|
</tr>
|
|
12
10
|
</thead>
|
|
13
11
|
<tbody>
|
|
14
12
|
<% @images.each_with_index do |image, i| %>
|
|
15
|
-
|
|
16
|
-
<%
|
|
17
|
-
|
|
13
|
+
|
|
14
|
+
<%
|
|
15
|
+
show_link = image_path(image)
|
|
16
|
+
edit_link = edit_image_path(image)
|
|
17
|
+
delete_link = image_path(image)
|
|
18
|
+
%>
|
|
18
19
|
|
|
19
20
|
<tr id="tr_image_<%= image.id %>">
|
|
20
21
|
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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%">
|
|
22
|
+
<th scope="row" style="text-align: center;">
|
|
23
|
+
<% if i < 0 %>
|
|
24
|
+
<i class="fa fa-check text-success"></i>
|
|
25
|
+
<% else %>
|
|
26
|
+
<%= i + 1 + (@per_page.to_i * (@current_page.to_i - 1)) %>
|
|
27
|
+
<% end %>
|
|
28
|
+
</th>
|
|
32
29
|
|
|
33
|
-
|
|
30
|
+
<td class="image-name"><%= link_to (image.imageable.try(:display_name) || "#{image.imageable_id} - #{image.imageable_type}" ), show_link, remote: true %></td>
|
|
34
31
|
|
|
35
|
-
|
|
32
|
+
<td class="image-name"><%= link_to image.type, show_link, remote: true %></td>
|
|
36
33
|
|
|
37
|
-
|
|
34
|
+
<td class="image-name" style="text-align: center;"><%= link_to image.imageable.class.name, show_link, remote: true %></td>
|
|
38
35
|
|
|
39
36
|
</tr>
|
|
40
37
|
<% end %>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<div id="div_event_show">
|
|
2
|
+
|
|
3
|
+
<div class="row">
|
|
4
|
+
|
|
5
|
+
<div class="col-md-12">
|
|
6
|
+
|
|
7
|
+
<% image_path = "/uploads/#{@image.type.underscore.split("/").last.pluralize}/#{@image.id}/#{@image.image}" %>
|
|
8
|
+
<%= image_tag(image_path, style:
|
|
9
|
+
" width: 100%;
|
|
10
|
+
display:block;
|
|
11
|
+
margin-left:auto;
|
|
12
|
+
margin-right:auto;") %>
|
|
13
|
+
|
|
14
|
+
<%= clear_tag(50) %>
|
|
15
|
+
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
<div class="row">
|
|
21
|
+
|
|
22
|
+
<div class="col-md-6 col-md-offset-3">
|
|
23
|
+
|
|
24
|
+
<%= link_to "Close", "#", onclick: "closeGenericModal();", class: "btn btn-primary btn-block" %>
|
|
25
|
+
|
|
26
|
+
<%= clear_tag(20) %>
|
|
27
|
+
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
</div>
|
|
31
|
+
|
|
32
|
+
</div>
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
var bodyContent = "<%= escape_javascript(render(:partial=>'form')) %>";
|
|
13
13
|
|
|
14
|
-
this.parent.
|
|
14
|
+
this.parent.showImageUploadModal(heading, bodyContent, true);
|
|
15
15
|
|
|
16
16
|
<%
|
|
17
17
|
text = "You have few errors. They have been highlighted."
|
|
@@ -22,15 +22,15 @@
|
|
|
22
22
|
|
|
23
23
|
<% else %>
|
|
24
24
|
|
|
25
|
-
this.parent.
|
|
25
|
+
this.parent.closeImageUploadModal();
|
|
26
26
|
|
|
27
27
|
//var heading = "Crop Image";
|
|
28
28
|
//var bodyContent = "<%#= escape_javascript(render(:partial=>"crop_form")) %>";
|
|
29
29
|
//this.parent.showModal(heading, bodyContent);
|
|
30
30
|
//this.parent.cropImage("form_crop_photo");
|
|
31
31
|
|
|
32
|
-
this.parent.$("
|
|
33
|
-
this.parent.$("
|
|
32
|
+
this.parent.$(".-large-image").attr("src", "<%= @image.image.large.url %>");
|
|
33
|
+
this.parent.$(".-small-image").attr("src", "<%= @image.image.small.url %>");
|
|
34
34
|
|
|
35
35
|
<% end %>
|
|
36
36
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<%= content_for :javascript_footer do %>
|
|
2
2
|
<script type="text/javascript">
|
|
3
|
-
this.parent.
|
|
3
|
+
this.parent.closeImageUploadModal();
|
|
4
4
|
|
|
5
5
|
this.parent.$(".<%= @resource.id %>-large-image").attr("src", "<%= @image.image.large.url %>");
|
|
6
6
|
this.parent.$(".<%= @resource.id %>-small-image").attr("src", "<%= @image.image.small.url %>");
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<% if @destroyed %>
|
|
2
|
+
|
|
3
|
+
$(".<%= @id %>-large-image").attr("src", "/assets/kuppayam/defaults/default-large.png");
|
|
4
|
+
$(".<%= @id %>-small-image").attr("src", "/assets/kuppayam/defaults/default-small.png");
|
|
5
|
+
|
|
6
|
+
// Showing Growl Like Message
|
|
7
|
+
notifySuccess("<%= escape_javascript(@notification[:title]) %>", "<%= escape_javascript(@notification[:message]) %>");
|
|
8
|
+
|
|
9
|
+
<% else %>
|
|
10
|
+
|
|
11
|
+
// Show the error in a modal
|
|
12
|
+
showMessageModal("<%= escape_javascript(@notification[:title]) %>", "<%= escape_javascript(@notification[:message]) %>");
|
|
13
|
+
|
|
14
|
+
// Showing Growl Like Message
|
|
15
|
+
notifyError("<%= escape_javascript(@notification[:title]) %>", "<%= escape_javascript(@notification[:message]) %>");
|
|
16
|
+
|
|
17
|
+
<% end %>
|
|
18
|
+
|
|
19
|
+
|