imagine_cms 5.2.4 → 5.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 672368e7c94e96e2469039b0db26f52b18e96124
4
- data.tar.gz: b8c4834bfdb9cf87c13f621d125cda575d9b606e
2
+ SHA256:
3
+ metadata.gz: 6395698e5fa9fccc7b7ae4d5178857dcd5678084505cc4df08da0a9f1ab23517
4
+ data.tar.gz: ef698c30a3234bb349183c084ea98dd2524e518b62270c5f18507b7631ad470e
5
5
  SHA512:
6
- metadata.gz: 9a30892f3a9cb461c93dfdb709e33b91fc35816ce6af17f9afc1a96ef119a60581912baf33a5f43b5c8677a0afbf1b852c49596239cdc047f18d2a8260141c72
7
- data.tar.gz: d724d7bf923d7ffeb5896def1e9f7bf9d71c64ebd19f4b3e2b371a00b2076b38f9ca97f0aaafc2d54f530114461006f6068de844fce9df133edb4ed5b9c170c7
6
+ metadata.gz: 0afe6cdfe911f124645fa829ea9e0c90c702261fefba1d49b86826adec69a15ae0c5909230cb349a26b21c51d6dc503b58949b933e4c4b7546937960d4ab2c54
7
+ data.tar.gz: 789fdb963f54155a91a74728e4ca0be2e7a75adaba77d8bf7e7a9a62e897b0fe9fa472c93790c74cca5dc5c68c449a1ee797cd9b5f92dcb57471afbc855c6c1d
data/Dockerfile CHANGED
@@ -1,7 +1,7 @@
1
1
  ### Docker image for imagine5 ###
2
2
 
3
3
  # See https://hub.docker.com/r/anamba/rails-dev/tags/ for a list of tags
4
- FROM anamba/rails-dev:1.0
4
+ FROM anamba/rails-dev:1.2.0
5
5
  LABEL maintainer="bbsoftware@biggerbird.com"
6
6
 
7
7
  # Update package list and upgrade pre-installed packages
@@ -9,7 +9,7 @@ RUN apt-get update
9
9
  RUN apt-get upgrade -y -o Dpkg::Options::="--force-confnew"
10
10
 
11
11
  # Install other packages we depend on
12
- RUN apt-get install -y mysql-client
12
+ # RUN apt-get install -y mysql-client
13
13
  RUN apt-get install -y memcached
14
14
  RUN apt-get install -y libmagickcore-dev libmagickwand-dev # for rmagick2 gem
15
15
  RUN apt-get install -y imagemagick # for mini-magick gem
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Imagine CMS
1
+ # Imagine 5 - Rails-powered CMS
2
2
 
3
3
  [![Version](https://img.shields.io/github/tag/anamba/imagine_cms.svg?maxAge=360)](https://github.com/anamba/imagine_cms/releases/latest)
4
4
  [![License](https://img.shields.io/github/license/anamba/imagine_cms.svg)](https://github.com/anamba/imagine_cms/blob/master/license.txt)
@@ -11,7 +11,9 @@ Thus, we created a CMS that is easy for clients to use, stays out of our way, an
11
11
 
12
12
  ## Current Status
13
13
 
14
- Imagine 5 is ready for production use (v5.2-stable branch), but is being wound down in favor of Imagine 6 and 7.
14
+ [Imagine 6](https://github.com/ImagineCMS/imagine_cms) (Elixir-based) is use in production.
15
+
16
+ Imagine 5 (this repo) is in use in production, but is being wound down in favor of Imagine 6.
15
17
 
16
18
  Imagine 4 (v4.2-stable branch) is available for apps tied to Rails 4.2, but is no longer actively maintained.
17
19
 
@@ -19,7 +21,7 @@ Imagine 3 (v3.0-stable branch) is available for apps tied to Rails 3.x, but is n
19
21
 
20
22
  Unless you are already familiar with Imagine, this project is not suitable for wider use. Why? Well, the reason this version of Imagine is published on Github is to ensure that if something happens to Bigger Bird, our clients will not be left high and dry. However, this version was never intended to be used by the general public.
21
23
 
22
- Imagine 7 will be a clean break and a great time to try Imagine CMS.
24
+ Imagine 7 (planned) will be a clean break and a great time to try Imagine CMS.
23
25
 
24
26
  ## History and Roadmap
25
27
 
@@ -35,9 +37,9 @@ All that is now firmly in the past. By extracting Imagine functionality into a R
35
37
  * Imagine 4.2 (Rails 4.2, Ruby 2.2): [DONE, v4.2-stable] Compatibility with Rails 4.2, many minor fixes and UI improvements
36
38
  * Imagine 5.0 (Rails 5.0, Ruby 2.2): [SKIPPED] Compatibility with Rails 5.0
37
39
  * Imagine 5.1 (Rails 5.1, Ruby 2.4): [SKIPPED] Compatibility with Rails 5.1
38
- * **Imagine 5.2 (Rails 5.2, Ruby 2.5/2.6): [CURRENT RELEASE] Compatibility with Rails 5.2**
39
- * Imagine 6 (Elixir/Phoenix + MySQL): Closed source internal release, stepping stone between Imagine 5 and 7
40
- * Imagine 7 (Elixir/Phoenix + CouchDB): [IN PROGRESS] Community-driven open source project
40
+ * **Imagine 5.2 (Rails 5.2, Ruby 2.5/2.6): [PRODUCTION] Compatibility with Rails 5.2**
41
+ * **Imagine 6 (Elixir/Phoenix + MySQL): [PRODUCTION] Bridge between Imagine 5 and 7**
42
+ * Imagine 7 (Elixir/Phoenix + CouchDB): [PLANNED] Community-driven open source project
41
43
 
42
44
  Imagine 6 is a complete, ground-up rewrite in Elixir, and Imagine 7 builds on that, while also replacing the original MySQL/MariaDB store with CouchDB for improved scaling, redundancy, and replication. Imagine 7 development will also be done in the open, in a new repository under the Imagine CMS organization, as a proper community-driven open source project (finally!). The core concepts will continue on, but not a single line of code will be preserved.
43
45
 
@@ -51,7 +53,7 @@ Get paid support and hosting for Imagine CMS straight from the people who made i
51
53
 
52
54
  ## Contributing
53
55
 
54
- Imagine 7 (Elixir rewrite) will be a true open source project with full community involvement, but this project (Ruby-based Imagine 3.x - 5.x) will remain mostly closed for the foreseeable future (source will continue to be made available on Github, but development will be driven by Bigger Bird only). If companies or individuals are willing to sponsor or co-develop new features, we can work something out.
56
+ Imagine 6 (Elixir rewrite) is now open source and Imagine 7 (MySQL -> CouchDB) will be a true open source project with full community involvement, but this project (Ruby-based Imagine 3.x - 5.x) will remain mostly closed for the foreseeable future (source will continue to be made available on Github, but development will be driven by Bigger Bird only). If companies or individuals are willing to sponsor or co-develop new features, we can work something out.
55
57
 
56
58
  ## Building Docker Image
57
59
 
@@ -59,7 +61,7 @@ Imagine 7 (Elixir rewrite) will be a true open source project with full communit
59
61
 
60
62
  ```bash
61
63
  docker build -t anamba/imagine5-dev:latest .
62
- docker tag anamba/imagine5-dev:latest anamba/imagine5-dev:5.2.3
64
+ docker tag anamba/imagine5-dev:latest anamba/imagine5-dev:5.2.4
63
65
  docker tag anamba/imagine5-dev:latest anamba/imagine5-dev:5.2
64
66
  docker push anamba/imagine5-dev
65
67
  ```
@@ -1,7 +1,9 @@
1
1
  // fix for a Firefox 69 issue
2
2
  .dojoFloatingPane {
3
- top: 50%; left: 50%;
4
- transform: translate(-50%, -50%);
3
+ position: fixed !important;
4
+ top: 40px;
5
+ left: 50%;
6
+ margin-left: -25%;
5
7
  }
6
8
 
7
9
  .search-result {
@@ -583,7 +583,7 @@ class Manage::CmsPagesController < Manage::ApplicationController
583
583
  FileUtils.cp(data.path(), localfile)
584
584
  end
585
585
 
586
- finish_upload_status "'#{File.basename(localfile)}'"
586
+ render json: { filename: File.basename(localfile) }.to_json
587
587
  end
588
588
 
589
589
  def crop_image
@@ -548,19 +548,7 @@ module CmsApplicationHelper
548
548
 
549
549
  temp.html_safe
550
550
  end
551
-
552
- # override this method to do your own custom subtitutions
553
- def substitute_placeholders_custom(temp, page)
554
- # an example:
555
- # begin
556
- # temp.gsub!(/<#\s*upcoming_event_date\s*#>/, page.article_date.strftime("<span class=\"month\">%b</span><span class=\"day\">%d</span>"))
557
- # rescue
558
- # end
559
-
560
- # remember to return your modified copy of temp
561
- temp
562
- end
563
-
551
+
564
552
 
565
553
  def template_option(name, type = :string)
566
554
  return nil unless @pg
@@ -1062,7 +1050,7 @@ EOF
1062
1050
 
1063
1051
 
1064
1052
  def cropper_image_tag(options)
1065
- ret = "<img id=\"testImage\" src=\"/assets/#{options[:url]}\" />".html_safe
1053
+ ret = "<img id=\"testImage\" src=\"/assets/#{options[:url]}\" style=\"display: block; position: relative;\" />".html_safe
1066
1054
  ret += javascript_tag("cropper = new Cropper.Img('testImage', { minWidth: 0, minHeight: 0, captureKeys: false, onEndCrop: onEndCrop });")
1067
1055
  end
1068
1056
 
@@ -0,0 +1,13 @@
1
+ module CmsCustomHelper
2
+ # override this method to do your own custom subtitutions
3
+ def substitute_placeholders_custom(temp, _page)
4
+ # an example:
5
+ # begin
6
+ # temp.gsub!(/<#\s*upcoming_event_date\s*#>/, page.article_date.strftime("<span class=\"month\">%b</span><span class=\"day\">%d</span>"))
7
+ # rescue
8
+ # end
9
+
10
+ # remember to return your modified copy of temp
11
+ temp
12
+ end
13
+ end
@@ -15,7 +15,7 @@
15
15
  return readCookie('user_auth_status') == 'authenticated';
16
16
  }
17
17
  </script>
18
- <script type="text/javascript" async>
18
+ <script type="text/javascript">
19
19
  var load_dojo = false;
20
20
  if (<%= @load_dojo || 'false' %>) {
21
21
  load_dojo = true;
@@ -26,7 +26,7 @@
26
26
  document.writeln('<link href="/assets/imagine_controls.css" media="screen" rel="stylesheet" type="text/css" />')
27
27
  }
28
28
  </script>
29
- <script type="text/javascript" async>
29
+ <script type="text/javascript">
30
30
  if (loggedIn()) {
31
31
  dojo.require("dojo.widget.Editor2");
32
32
  dojo.require("dojo.widget.Editor2Plugin.TableOperation");
@@ -4,17 +4,30 @@
4
4
  -%>
5
5
  <%= javascript_tag <<-EOF
6
6
  var curInst = dojo.widget.Editor2Manager.getCurrentInstance();
7
- linkNode = dojo.withGlobal(curInst.window, "getAncestorElement", dojo.html.selection, ['a']);
7
+ var linkNode = dojo.withGlobal(curInst.window, "getAncestorElement", dojo.html.selection, ['a']);
8
+ var html = '';
8
9
 
9
10
  curInst.restoreSelection();
10
11
 
12
+ var removeInvalidTags = function(html) {
13
+ var el = document.createElement('div');
14
+ el.innerHTML = html;
15
+ ['script', 'title'].forEach(function(tag) {
16
+ el.querySelectorAll(tag).forEach(function(del) { del.remove(); });
17
+ });
18
+ return el.innerHTML;
19
+ };
20
+
11
21
  if (!linkNode) {
12
- var html = dojo.withGlobal(curInst.window, 'getSelectedHtml', dojo.html.selection);
22
+ html = dojo.withGlobal(curInst.window, 'getSelectedHtml', dojo.html.selection);
13
23
  } else {
14
- var html = linkNode.innerHTML;
24
+ html = linkNode.innerHTML;
15
25
  dojo.withGlobal(curInst.window, 'selectElement', dojo.html.selection, [linkNode]);
16
26
  }
17
27
 
28
+ html = removeInvalidTags(html).trim();
29
+ if (html === '') html = "Link Text";
30
+
18
31
  curInst.execCommand('inserthtml', '<a href=\"#{page_file_path(@pg, @filename)}\" class=\"file-#{ext}\" target=\"_blank\">'+html+'</a>');
19
32
  cancelInsertFile();
20
33
  EOF
@@ -197,7 +197,7 @@ Pressing "Save Feature Image" will crop the image and set it as the new feature
197
197
  </tr>
198
198
  </table>
199
199
 
200
- <%= submit_tag 'Save Feature Image', :class => 'form_button', :onclick => 'cropper.remove(); this.disabled = true; this.value = "Saving...";' %>
200
+ <%= submit_tag 'Save Feature Image', :class => 'form_button', data: { disable_with: 'Saving...' } %>
201
201
  <%= link_to_function "Cancel", "cancelSelectThumbnail()" %>
202
202
  <%- end -%>
203
203
  </center>
@@ -1,25 +1,27 @@
1
1
  <script type="text/javascript">
2
+ window.scrollTo(0,0);
3
+
2
4
  var resize_ratio = 1.0;
3
5
  var aspect_ratio = <%= @width %>.0 / <%= @height %>;
4
6
  var imageSizeLocked = false;
5
-
7
+
6
8
  try {
7
9
  if (cropper) cropper.remove();
8
10
  } catch (e) {}
9
-
11
+
10
12
  deselectAllPresets = function() {
11
13
  jQuery('input[type=radio].image-size-preset').attr('checked', false);
12
14
  }
13
-
15
+
14
16
  onEndCrop = function (coords, dimensions) {
15
17
  if (dimensions.width > 0 && dimensions.height > 0) {
16
18
  var size_changed = false;
17
-
19
+
18
20
  $('image_x1').value = coords.x1;
19
21
  $('image_y1').value = coords.y1;
20
22
  $('image_x2').value = coords.x2;
21
23
  $('image_y2').value = coords.y2;
22
-
24
+
23
25
  if (dimensions.width != $('image_width').value) {
24
26
  $('image_width').value = dimensions.width;
25
27
  size_changed = true;
@@ -28,14 +30,14 @@
28
30
  $('image_height').value = dimensions.height;
29
31
  size_changed = true;
30
32
  }
31
-
33
+
32
34
  if (size_changed) {
33
35
  setResizeRatio();
34
36
  aspect_ratio = 1.0 * dimensions.width / dimensions.height;
35
-
37
+
36
38
  $('selection_x2').value = dimensions.width;
37
39
  $('selection_y2').value = dimensions.height;
38
-
40
+
39
41
  if (!imageSizeLocked) {
40
42
  if (resize_ratio) {
41
43
  $('image_max_width').value = Math.round(dimensions.width * resize_ratio);
@@ -45,12 +47,12 @@
45
47
  $('image_max_height').value = dimensions.height;
46
48
  }
47
49
  }
48
-
50
+
49
51
  $('aspect_ratio').innerHTML = setPrecision(dimensions.width/dimensions.height, 3);
50
52
  }
51
53
  }
52
54
  }
53
-
55
+
54
56
  resizeCropper = function () {
55
57
  width = $('selection_x2').value;
56
58
  height = $('selection_y2').value;
@@ -63,10 +65,10 @@
63
65
  cropper.selArea.show();
64
66
  cropper.drawArea();
65
67
  cropper.endCrop();
66
-
68
+
67
69
  setResizeRatio();
68
70
  }
69
-
71
+
70
72
  resizeCropperScaled = function () {
71
73
  if (imageSizeLocked) {
72
74
  width = parseInt($('image_max_width').value);
@@ -81,37 +83,37 @@
81
83
  resizeCropper();
82
84
  }
83
85
  }
84
-
86
+
85
87
  setResizeRatio = function () {
86
88
  crop_width = parseInt($('image_max_width').value);
87
89
  selection_width = parseInt($('selection_x2').value); // this is correct... x2 is the sel width
88
-
90
+
89
91
  if (crop_width > 10 && selection_width > 10) {
90
92
  resize_ratio = 1.0 * $('image_max_width').value / $('selection_x2').value;
91
93
  } else {
92
94
  resize_ratio = 1.0;
93
95
  }
94
96
  }
95
-
97
+
96
98
  lockImageSize = function () {
97
99
  imageSizeLocked = true;
98
100
  cropper.options.ratioDim = { x: parseInt($('image_max_width').value),
99
101
  y: parseInt($('image_max_height').value) };
100
102
  reloadCropper();
101
-
103
+
102
104
  $('icon_unlocked').hide();
103
105
  $('icon_locked').show();
104
106
  }
105
-
107
+
106
108
  unlockImageSize = function () {
107
109
  imageSizeLocked = false;
108
110
  cropper.options.ratioDim = { x: 0, y: 0 };
109
111
  reloadCropper();
110
-
112
+
111
113
  $('icon_locked').hide();
112
114
  $('icon_unlocked').show();
113
115
  }
114
-
116
+
115
117
  reloadCropper = function () {
116
118
  oldOptions = cropper.options;
117
119
  oldOptions.displayOnInit = 1;
@@ -126,13 +128,13 @@
126
128
  cropper.remove();
127
129
  cropper = new Cropper.Img('testImage', oldOptions);
128
130
  }
129
-
131
+
130
132
  recalculateWidth = function () {
131
133
  if (imageSizeLocked) {
132
134
  $('image_max_width').value = Math.round(parseInt($('image_max_height').value) / aspect_ratio);
133
135
  }
134
136
  }
135
-
137
+
136
138
  recalculateHeight = function () {
137
139
  if (imageSizeLocked) {
138
140
  $('image_max_height').value = Math.round(parseInt($('image_max_width').value) / aspect_ratio);
@@ -161,10 +163,10 @@ Pressing "Save Image" will crop the image and insert it into the page.
161
163
  <legend>Adjust Crop:</legend>
162
164
  <%= text_field :selection, :x2, :size => 3, :onkeyup => "resizeCropper();" %> x <%= text_field :selection, :y2, :size => 3, :onkeyup => "resizeCropper();" %>
163
165
  </fieldset>
164
-
166
+
165
167
  <fieldset style="padding: 10px 15px; text-align: center;">
166
168
  <legend>Output Image Dimensions</legend>
167
-
169
+
168
170
  <%- if defined?(CmsImageCropPresets) -%>
169
171
  <div style="text-align: left; margin-bottom: 20px;">
170
172
  <strong>Presets:</strong><br>
@@ -174,17 +176,17 @@ Pressing "Save Image" will crop the image and insert it into the page.
174
176
  <%- end -%>
175
177
  </div>
176
178
  <%- end -%>
177
-
179
+
178
180
  <%= text_field :image, :max_width, :size => 3, :value => @width, :onchange => "deselectAllPresets(); recalculateHeight();" %>
179
181
  x <%= text_field :image, :max_height, :size => 3, :value => @height, :onchange => "deselectAllPresets(); recalculateWidth();" %>
180
182
  <%= javascript_tag "$('image_max_width').onkeydown = disableEnterKey; $('image_max_height').onkeydown = disableEnterKey;" %>
181
-
183
+
182
184
  <%= image_tag('management/icon_unlocked.png', :id => 'icon_unlocked', :onclick => "deselectAllPresets(); lockImageSize();") %>
183
185
  <%= image_tag('management/icon_locked.png', :id => 'icon_locked', :onclick => "deselectAllPresets(); unlockImageSize();", :style => 'display: none;') %>
184
-
186
+
185
187
  <%= link_to_function "Apply", "resizeCropperScaled();" %> |
186
188
  <%= link_to_function "Reset", "cropper.reset(); resize_ratio = 1.0;" %>
187
-
189
+
188
190
  <span id="aspect_ratio" style="display: none;"><%= sprintf("%.3f", @aspect_ratio) %></span><br/>
189
191
  <%= text_field :image, :x1, :style => "display: none" %>
190
192
  <%= text_field :image, :y1, :style => "display: none" %>
@@ -196,8 +198,8 @@ Pressing "Save Image" will crop the image and insert it into the page.
196
198
  </td>
197
199
  </tr>
198
200
  </table>
199
-
200
- <%= submit_tag 'Save Image', :class => 'form_button', :style => 'width: 90px;', :onclick => 'cropper.remove(); this.disabled = true; this.value = "Saving...";' %>
201
+
202
+ <%= submit_tag 'Save Image', class: 'form_button', style: 'width: 90px;', data: { disable_with: 'Saving...' } %>
201
203
  <%= link_to_function "Cancel", "cancelInsertImage();" %>
202
204
  <%- end -%>
203
205
  </center>
@@ -197,7 +197,7 @@ Pressing "Save Thumbnail" will crop the thumbnail and set it as the new thumbnai
197
197
  </tr>
198
198
  </table>
199
199
 
200
- <%= submit_tag 'Save Thumbnail', :class => 'form_button', :onclick => 'cropper.remove(); this.disabled = true; this.value = "Saving...";' %>
200
+ <%= submit_tag 'Save Thumbnail', class: 'form_button', data: { disable_with: 'Saving...' } %>
201
201
  <%= link_to_function "Cancel", "cancelSelectThumbnail()" %>
202
202
  <%- end -%>
203
203
  </center>
@@ -21,7 +21,7 @@
21
21
  <table id="dlg-page-properties">
22
22
  <col width="120"><col width="*"><col width="5">
23
23
  <%- if @pg.id != 1 -%>
24
- <tr>
24
+ <tr id="cms_page-form-name-row">
25
25
  <td>Name (for URL):</td>
26
26
  <td>
27
27
  <%= text_field :pg, :name, class: 'form', style: 'margin-bottom: 0; width: 150px', onchange: (@pg.new_record? ? '' : "if (!confirm('Are you sure you want to change the name of this page? Any bookmarks or links to this page will no longer work if you proceed with this change.')) { this.value = $('original_name').value; };") %><br/>
@@ -30,6 +30,15 @@
30
30
  </td>
31
31
  </tr>
32
32
  <%- end -%>
33
+ <tr id="cms_page-form-parent_id-row" style="display: none;">
34
+ <td>Parent Page ID:</td>
35
+ <td><%= text_field :pg, :parent_id, class: 'form', style: 'width: 100%;' %></td>
36
+ </tr>
37
+ <script>
38
+ let nameRow = document.getElementById("cms_page-form-name-row");
39
+ let parentIdRow = document.getElementById("cms_page-form-parent_id-row");
40
+ if (nameRow && parentIdRow) nameRow.addEventListener("click", (e) => { if (e.altKey) { parentIdRow.style.display = "table-row"; } });
41
+ </script>
33
42
  <tr>
34
43
  <td>Page Title:</td>
35
44
  <td><%= text_field :pg, :title, class: 'form', style: 'width: 100%;' %></td>
@@ -5,31 +5,71 @@
5
5
  certain your image is already web-ready. Otherwise, click "Next" to crop and
6
6
  resize your image before using it.</p>
7
7
 
8
- <%= form_tag_with_upload_progress({ :action => 'receive_image', :id => @pg, :overwrite => 1 },
9
- { :finish => "if (arguments[0]) { $('filename').value = arguments[0]; $('mainform').onsubmit(); }" }) do -%>
8
+ <%= form_tag({ action: 'receive_image', id: @pg, overwrite: 1 }, { id: 'upload-image-form', multipart: true }) do %>
10
9
  <table>
11
10
  <tr>
12
11
  <td>File:</td>
13
12
  <td>
14
- <%= file_field 'file', 'data', :class => 'form', :style => 'margin-bottom: 0; width: 150px' %><br/>
13
+ <%= file_field 'file', 'data', :class => 'form', :style => 'margin-bottom: 0; min-width: 150px' %><br/>
15
14
  <span style="color: #888888">Valid image types: jpeg, png, gif</span>
16
15
  </td>
17
16
  </tr>
18
17
  <tr>
19
18
  <td></td>
20
19
  <td>
21
- <div id="upload_status_div" class="error"><%= upload_status_tag %></div>
22
- <%= submit_tag 'Next', :class => 'form_button', :style => 'width: 70px;', :onclick => "if ($('file_data').value == '') return false; $('next_clicked_upload').value = '1'; $('next_clicked').value = '1'; this.disabled = true; this.value = 'Uploading...';" %>
23
- <%= submit_tag 'Finish', :class => 'form_button', :style => 'width: 70px;', :onclick => "if ($('file_data').value == '') return false; this.disabled = true; this.value = 'Uploading...';" %>
24
- <%= link_to_function "Cancel", "cancelSelectThumbnail()" %>
20
+ <%= submit_tag 'Next', id: 'upload-image-next-button', class: 'form_button', style: 'min-width: 70px' %>
21
+ <%= submit_tag 'Finish', id: 'upload-image-finish-button', class: 'form_button', style: 'min-width: 70px' %>
25
22
  <%= text_field_tag 'next_clicked_upload', '0', :style => 'display: none' %>
26
23
  </td>
27
24
  </tr>
28
25
  </table>
29
26
  <%- end -%>
30
27
 
31
- <%= form_remote_tag(:update => 'select_thumbnail_dialog_content', :html => { :id => 'mainform' },
32
- :url => { :action => 'crop_feature_image', :id => @pg }) do -%>
33
- <%= text_field_tag 'next_clicked', '0', :style => 'display: none' %>
34
- <%= text_field_tag 'filename', '', :style => 'display: none' %>
28
+ <%= form_remote_tag(update: 'select_thumbnail_dialog_content', html: { id: 'mainform' },
29
+ url: { action: 'crop_feature_image', id: @pg }) do %>
30
+ <%= text_field_tag 'next_clicked', '0', style: 'display: none' %>
31
+ <%= text_field_tag 'filename', '', style: 'display: none' %>
35
32
  <%- end -%>
33
+
34
+ <script>
35
+ const uploadImageForm = document.getElementById("upload-image-form");
36
+ const nextButton = document.getElementById("upload-image-next-button");
37
+ const finishButton = document.getElementById("upload-image-finish-button");
38
+ const uploadFileField = document.getElementById("file_data");
39
+
40
+ nextButton.addEventListener("click", (e) => {
41
+ e.target.dataset.disableWith = "Uploading...";
42
+ document.getElementById("next_clicked").value = "1";
43
+ });
44
+ finishButton.addEventListener("click", (e) => {
45
+ e.target.dataset.disableWith = "Uploading...";
46
+ });
47
+
48
+ uploadImageForm.addEventListener("submit", async (e) => {
49
+ e.preventDefault();
50
+
51
+ if (uploadFileField.value == "") {
52
+ setTimeout(() => {
53
+ nextButton.value = "Next";
54
+ finishButton.value = "Finish";
55
+ nextButton.dataset.disableWith = null;
56
+ finishButton.dataset.disableWith = null;
57
+ nextButton.disabled = false;
58
+ finishButton.disabled = false;
59
+ });
60
+ return;
61
+ }
62
+
63
+ let file = uploadFileField.files[0];
64
+ let formData = new FormData(uploadImageForm);
65
+
66
+ let resp = await fetch(uploadImageForm.action, {
67
+ method: 'POST',
68
+ body: formData
69
+ });
70
+ let data = await resp.json();
71
+
72
+ document.getElementById("filename").value = data.filename;
73
+ document.getElementById("mainform").onsubmit();
74
+ });
75
+ </script>
@@ -11,14 +11,14 @@
11
11
  <tr>
12
12
  <td>File:</td>
13
13
  <td>
14
- <%= file_field 'file', 'data', :class => 'form', :style => 'margin-bottom: 0; width: 150px' %>
14
+ <%= file_field 'file', 'data', class: 'form', style: 'margin-bottom: 0; min-width: 150px' %>
15
15
  </td>
16
16
  </tr>
17
17
  <tr>
18
18
  <td></td>
19
19
  <td>
20
20
  <div id="upload_status_div" class="error"><%= upload_status_tag %></div>
21
- <%= submit_tag 'Finish', :class => 'form_button', :style => 'width: 70px;', :onclick => "if ($('file_data').value == '') return false; this.disabled = true; this.value = 'Uploading...';" %>
21
+ <%= submit_tag 'Finish', class: 'form_button', style: 'width: 70px;', data: { disable_with: 'Uploading...' } %>
22
22
  <%= link_to_function "Cancel", "cancelInsertFile()" %>
23
23
  </td>
24
24
  </tr>
@@ -1,4 +1,8 @@
1
- <%= javascript_tag "try { $('insert_file_dialog_content').innerHTML = ''; } catch (e) {}" %>
1
+ <script>
2
+ try {
3
+ document.getElementById("insert_file_dialog_content").innerHTML = "";
4
+ } catch (e) { }
5
+ </script>
2
6
 
3
7
  <div id="save_errors" class="error"></div>
4
8
  <h3 style="margin-bottom: 10px;">Insert Image</h3>
@@ -10,12 +14,11 @@
10
14
  certain your image is already web-ready. Otherwise, click "Next" to crop and
11
15
  resize your image before using it.</p>
12
16
 
13
- <%= form_tag_with_upload_progress({ :action => 'receive_image', :id => @pg },
14
- { :finish => "if (arguments[0]) { $('filename').value = arguments[0]; $('mainform').onsubmit(); }" }) do -%>
17
+ <%= form_tag({ action: 'receive_image', id: @pg }, { id: 'upload-image-form', multipart: true }) do %>
15
18
  <table>
16
19
  <tr>
17
20
  <td width="70">Image file:</td>
18
- <td><%= file_field 'file', 'data', :class => 'form', :style => 'margin-bottom: 0; width: 150px' %></td>
21
+ <td><%= file_field 'file', 'data', class: 'form', style: 'margin-bottom: 0; min-width: 250px' %></td>
19
22
  </tr>
20
23
  <tr>
21
24
  <td></td>
@@ -24,50 +27,119 @@
24
27
  <tr>
25
28
  <td></td>
26
29
  <td>
27
- <div id="upload_status_div" class="error"><%= upload_status_tag %></div>
28
- <%= submit_tag 'Next', :class => 'form_button', :style => 'width: 70px;', :onclick => "if ($('file_data').value == '') return false; $('next_clicked_upload').value = '1'; $('next_clicked').value = '1'; this.disabled = true; this.value = 'Uploading...';" %>
29
- <%= submit_tag 'Finish', :class => 'form_button', :style => 'width: 70px;', :onclick => "if ($('file_data').value == '') return false; this.disabled = true; this.value = 'Uploading...';" %>
30
+ <%= submit_tag 'Next', id: 'upload-image-next-button', class: 'form_button', style: 'min-width: 70px' %>
31
+ <%= submit_tag 'Finish', id: 'upload-image-finish-button', class: 'form_button', style: 'min-width: 70px' %>
30
32
  <%= link_to_function "Cancel", "cancelInsertImage()" %>
31
- <%= text_field_tag 'next_clicked_upload', '0', :style => 'display: none' %>
32
33
  </td>
33
34
  </tr>
34
35
  </table>
35
- <%- end -%>
36
- </fieldset><br/>
36
+ <% end %>
37
+ </fieldset><br>
37
38
 
38
39
  <fieldset>
39
40
  <legend>New Photo Gallery</legend>
40
41
 
41
42
  <p>Upload a zip file of images to create a photo gallery.</p>
42
43
 
43
- <%= form_tag_with_upload_progress({ :action => 'receive_gallery', :id => @pg },
44
- { :finish => "if (arguments[0]) { $('dirname').value = arguments[0]; $('mainform_gallery').onsubmit(); }" }) do -%>
44
+ <%= form_tag({ action: 'receive_gallery', id: @pg }, { id: 'upload-gallery-form', multipart: true }) do %>
45
45
  <table>
46
46
  <tr>
47
47
  <td width="70">Zip file:</td>
48
48
  <td>
49
- <%= file_field 'gallery_file', 'data', :class => 'form', :style => 'margin-bottom: 0; width: 150px' %><br/>
49
+ <%= file_field 'gallery_file', 'data', class: 'form', style: 'margin-bottom: 0; min-width: 250px' %><br/>
50
50
  </td>
51
51
  </tr>
52
52
  <tr>
53
53
  <td></td>
54
54
  <td>
55
- <div id="upload_status_div" class="error"><%= upload_status_tag %></div>
56
- <%= submit_tag 'Next', :class => 'form_button', :style => 'width: 70px;', :onclick => "if ($('gallery_file_data').value == '') return false; this.disabled = true; this.value = 'Uploading...';" %>
55
+ <%= submit_tag 'Next', id: 'upload-gallery-next-button', class: 'form_button', style: 'min-width: 70px' %>
57
56
  <%= link_to_function "Cancel", "cancelInsertImage()" %>
58
57
  </td>
59
58
  </tr>
60
59
  </table>
61
- <%- end -%>
60
+ <% end %>
62
61
  </fieldset><br>
63
62
 
64
- <%= form_remote_tag(:update => 'insert_image_dialog_content', :html => { :id => 'mainform' },
65
- :url => { :action => 'crop_image', :id => @pg }) do -%>
66
- <%= text_field_tag 'next_clicked', '0', :style => 'display: none' %>
67
- <%= text_field_tag 'filename', '', :style => 'display: none' %>
63
+ <%= form_remote_tag(update: 'insert_image_dialog_content', html: { id: 'mainform' },
64
+ url: { action: 'crop_image', id: @pg }) do %>
65
+ <%= text_field_tag 'next_clicked', '0', style: 'display: none' %>
66
+ <%= text_field_tag 'filename', '', style: 'display: none' %>
68
67
  <%- end -%>
69
68
 
70
- <%= form_remote_tag(:update => 'insert_image_dialog_content', :html => { :id => 'mainform_gallery' },
71
- :url => { :action => 'gallery_setup', :id => @pg }) do -%>
72
- <%= text_field_tag :dirname, '', :style => 'display: none' %>
69
+ <%= form_remote_tag(update: 'insert_image_dialog_content', html: { id: 'mainform_gallery' },
70
+ url: { action: 'gallery_setup', id: @pg }) do %>
71
+ <%= text_field_tag :dirname, '', style: 'display: none' %>
73
72
  <%- end -%>
73
+
74
+ <script>
75
+ const uploadImageForm = document.getElementById("upload-image-form");
76
+ const uploadGalleryForm = document.getElementById("upload-gallery-form");
77
+ const nextButton = document.getElementById("upload-image-next-button");
78
+ const finishButton = document.getElementById("upload-image-finish-button");
79
+ const uploadFileField = document.getElementById("file_data");
80
+ const galleryNextButton = document.getElementById("upload-gallery-next-button");
81
+
82
+ nextButton.addEventListener("click", (e) => {
83
+ e.target.dataset.disableWith = "Uploading...";
84
+ document.getElementById("next_clicked").value = "1";
85
+ });
86
+ finishButton.addEventListener("click", (e) => {
87
+ e.target.dataset.disableWith = "Uploading...";
88
+ });
89
+ galleryNextButton.addEventListener("click", (e) => {
90
+ e.target.dataset.disableWith = "Uploading...";
91
+ });
92
+
93
+ uploadImageForm.addEventListener("submit", async (e) => {
94
+ e.preventDefault();
95
+
96
+ if (uploadFileField.value == "") {
97
+ setTimeout(() => {
98
+ nextButton.value = "Next";
99
+ finishButton.value = "Finish";
100
+ nextButton.dataset.disableWith = null;
101
+ finishButton.dataset.disableWith = null;
102
+ nextButton.disabled = false;
103
+ finishButton.disabled = false;
104
+ });
105
+ return;
106
+ }
107
+
108
+ let file = uploadFileField.files[0];
109
+ let formData = new FormData(uploadImageForm);
110
+
111
+ let resp = await fetch(uploadImageForm.action, {
112
+ method: 'POST',
113
+ body: formData
114
+ });
115
+ let data = await resp.json();
116
+
117
+ document.getElementById("filename").value = data.filename;
118
+ document.getElementById("mainform").onsubmit();
119
+ });
120
+
121
+ uploadGalleryForm.addEventListener("submit", async (e) => {
122
+ e.preventDefault();
123
+
124
+ if (uploadFileField.value == "") {
125
+ setTimeout(() => {
126
+ galleryNextButton.value = "Next";
127
+ galleryNextButton.dataset.disableWith = null;
128
+ galleryNextButton.disabled = false;
129
+ });
130
+ return;
131
+ }
132
+
133
+ let file = uploadFileField.files[0];
134
+ let formData = new FormData(uploadImageForm);
135
+
136
+ let resp = await fetch(uploadImageForm.action, {
137
+ method: 'POST',
138
+ body: formData
139
+ });
140
+ let data = await resp.json();
141
+
142
+ document.getElementById("dirname").value = data.filename;
143
+ document.getElementById("mainform_gallery").onsubmit();
144
+ });
145
+ </script>
@@ -5,31 +5,71 @@
5
5
  certain your image is already web-ready. Otherwise, click "Next" to crop and
6
6
  resize your image before using it.</p>
7
7
 
8
- <%= form_tag_with_upload_progress({ :action => 'receive_image', :id => @pg, :overwrite => 1 },
9
- { :finish => "if (arguments[0]) { $('filename').value = arguments[0]; $('mainform').onsubmit(); }" }) do -%>
8
+ <%= form_tag({ action: 'receive_image', id: @pg, overwrite: 1 }, { id: 'upload-image-form', multipart: true }) do %>
10
9
  <table>
11
10
  <tr>
12
11
  <td>File:</td>
13
12
  <td>
14
- <%= file_field 'file', 'data', :class => 'form', :style => 'margin-bottom: 0; width: 150px' %><br/>
13
+ <%= file_field 'file', 'data', :class => 'form', :style => 'margin-bottom: 0; min-width: 150px' %><br>
15
14
  <span style="color: #888888">Valid image types: jpeg, png, gif</span>
16
15
  </td>
17
16
  </tr>
18
17
  <tr>
19
18
  <td></td>
20
19
  <td>
21
- <div id="upload_status_div" class="error"><%= upload_status_tag %></div>
22
- <%= submit_tag 'Next', :class => 'form_button', :style => 'width: 70px;', :onclick => "if ($('file_data').value == '') return false; $('next_clicked_upload').value = '1'; $('next_clicked').value = '1'; this.disabled = true; this.value = 'Uploading...';" %>
23
- <%= submit_tag 'Finish', :class => 'form_button', :style => 'width: 70px;', :onclick => "if ($('file_data').value == '') return false; this.disabled = true; this.value = 'Uploading...';" %>
20
+ <%= submit_tag 'Next', id: 'upload-image-next-button', class: 'form_button', style: 'min-width: 70px' %>
21
+ <%= submit_tag 'Finish', id: 'upload-image-finish-button', class: 'form_button', style: 'min-width: 70px' %>
24
22
  <%= link_to_function "Cancel", "cancelSelectThumbnail()" %>
25
- <%= text_field_tag 'next_clicked_upload', '0', :style => 'display: none' %>
26
23
  </td>
27
24
  </tr>
28
25
  </table>
29
26
  <%- end -%>
30
27
 
31
- <%= form_remote_tag(:update => 'select_thumbnail_dialog_content', :html => { :id => 'mainform' },
32
- :url => { :action => 'crop_thumb', :id => @pg }) do -%>
33
- <%= text_field_tag 'next_clicked', '0', :style => 'display: none' %>
34
- <%= text_field_tag 'filename', '', :style => 'display: none' %>
28
+ <%= form_remote_tag(update: 'select_thumbnail_dialog_content', html: { id: 'mainform' },
29
+ url: { action: 'crop_thumb', id: @pg }) do %>
30
+ <%= text_field_tag 'next_clicked', '0', style: 'display: none' %>
31
+ <%= text_field_tag 'filename', '', style: 'display: none' %>
35
32
  <%- end -%>
33
+
34
+ <script>
35
+ const uploadImageForm = document.getElementById("upload-image-form");
36
+ const nextButton = document.getElementById("upload-image-next-button");
37
+ const finishButton = document.getElementById("upload-image-finish-button");
38
+ const uploadFileField = document.getElementById("file_data");
39
+
40
+ nextButton.addEventListener("click", (e) => {
41
+ e.target.dataset.disableWith = "Uploading...";
42
+ document.getElementById("next_clicked").value = "1";
43
+ });
44
+ finishButton.addEventListener("click", (e) => {
45
+ e.target.dataset.disableWith = "Uploading...";
46
+ });
47
+
48
+ uploadImageForm.addEventListener("submit", async (e) => {
49
+ e.preventDefault();
50
+
51
+ if (uploadFileField.value == "") {
52
+ setTimeout(() => {
53
+ nextButton.value = "Next";
54
+ finishButton.value = "Finish";
55
+ nextButton.dataset.disableWith = null;
56
+ finishButton.dataset.disableWith = null;
57
+ nextButton.disabled = false;
58
+ finishButton.disabled = false;
59
+ });
60
+ return;
61
+ }
62
+
63
+ let file = uploadFileField.files[0];
64
+ let formData = new FormData(uploadImageForm);
65
+
66
+ let resp = await fetch(uploadImageForm.action, {
67
+ method: 'POST',
68
+ body: formData
69
+ });
70
+ let data = await resp.json();
71
+
72
+ document.getElementById("filename").value = data.filename;
73
+ document.getElementById("mainform").onsubmit();
74
+ });
75
+ </script>
@@ -95,7 +95,7 @@
95
95
  <td></td>
96
96
  <td>
97
97
  <div id="upload_status_div" class="error"><%= upload_status_tag %></div>
98
- <%= submit_tag 'Next', :class => 'form_button', :style => 'width: 70px;', :onclick => "if ($('gallery_file_data').value == '') return false; this.disabled = true; this.value = 'Uploading...';" %>
98
+ <%= submit_tag 'Next', class: 'form_button', style: 'width: 70px;', data: { disable_with: 'Uploading...' } %>
99
99
  </td>
100
100
  </tr>
101
101
  </table>
@@ -20,7 +20,7 @@
20
20
  <td><%= u.last_name %></td>
21
21
  <td><%= u.active? ? 'Y' : 'N' %>
22
22
  <td><%= button_to(u.active? ? 'Disable' : 'Enable', { :action => (u.active? ? 'disable' : 'enable'), :id => u}, :class => 'form_button') if u.username != session[:user_username] %></td>
23
- <td><%= button_to('Delete', { :action => 'destroy', :id => u }, :method => :delete, :class => 'form_button', :onclick => "return confirm('Are you sure you want to delete #{u.username}?');") if u.username != session[:user_username] %></td>
23
+ <td><%= button_to('Delete', { action: 'destroy', id: u }, method: :delete, class: 'form_button', data: { confirm: "Are you sure you want to delete #{u.username}?" }) if u.username != session[:user_username] %></td>
24
24
  </tr>
25
25
  <% end %>
26
26
  </table>
@@ -51,6 +51,7 @@ module ImagineCms
51
51
  end
52
52
 
53
53
  initializer 'imagine_cms.load_helpers' do |app|
54
+ ActionController::Base.send :include, CmsCustomHelper
54
55
  ActionController::Base.send :include, CmsApplicationHelper
55
56
  end
56
57
 
@@ -1,3 +1,3 @@
1
1
  module ImagineCms
2
- VERSION = "5.2.4"
2
+ VERSION = "5.2.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: imagine_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.2.4
4
+ version: 5.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Namba
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-12 00:00:00.000000000 Z
11
+ date: 2021-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -398,6 +398,7 @@ files:
398
398
  - app/controllers/management/users_controller.rb
399
399
  - app/controllers/util_controller.rb
400
400
  - app/helpers/cms_application_helper.rb
401
+ - app/helpers/cms_custom_helper.rb
401
402
  - app/mailers/imagine_cms_mailer.rb
402
403
  - app/models/cms_page.rb
403
404
  - app/models/cms_page_object.rb
@@ -595,7 +596,7 @@ homepage: https://github.com/anamba/imagine_cms
595
596
  licenses:
596
597
  - AGPLv3
597
598
  metadata: {}
598
- post_install_message:
599
+ post_install_message:
599
600
  rdoc_options: []
600
601
  require_paths:
601
602
  - lib
@@ -610,9 +611,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
610
611
  - !ruby/object:Gem::Version
611
612
  version: 1.8.11
612
613
  requirements: []
613
- rubyforge_project:
614
- rubygems_version: 2.5.2.3
615
- signing_key:
614
+ rubygems_version: 3.0.3
615
+ signing_key:
616
616
  specification_version: 4
617
617
  summary: Imagine Content Management System for Rails
618
618
  test_files: