imagine_cms 5.2.2 → 5.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/Dockerfile +2 -2
- data/README.md +18 -12
- data/app/assets/javascripts/imagine_cms/core.js +1 -1
- data/app/assets/stylesheets/imagine_cms.css.scss +15 -7
- data/app/controllers/manage/cms_pages_controller.rb +3 -5
- data/app/helpers/cms_application_helper.rb +22 -26
- data/app/helpers/cms_custom_helper.rb +13 -0
- data/app/views/imagine_cms/_dialogs.html.erb +3 -3
- data/app/views/imagine_cms/_header.html.erb +2 -2
- data/app/views/manage/cms_pages/_create_file_link.html.erb +16 -3
- data/app/views/manage/cms_pages/_crop_feature_image.html.erb +1 -1
- data/app/views/manage/cms_pages/_crop_image.html.erb +31 -29
- data/app/views/manage/cms_pages/_crop_thumb.html.erb +1 -1
- data/app/views/manage/cms_pages/_edit_page.html.erb +10 -1
- data/app/views/manage/cms_pages/_gallery_setup.html.erb +1 -1
- data/app/views/manage/cms_pages/_list_page_select.html.erb +17 -7
- data/app/views/manage/cms_pages/_list_pages_select.html.erb +1 -1
- data/app/views/manage/cms_pages/_upload_feature_image.html.erb +51 -11
- data/app/views/manage/cms_pages/_upload_file.html.erb +2 -2
- data/app/views/manage/cms_pages/_upload_image.html.erb +96 -23
- data/app/views/manage/cms_pages/_upload_thumb.html.erb +51 -11
- data/app/views/manage/cms_pages/gallery_management.html.erb +1 -1
- data/app/views/manage/cms_pages/index.html.erb +1 -1
- data/app/views/manage/cms_pages/select_page.html.erb +32 -27
- data/app/views/manage/cms_pages/toolbar_preview.html.erb +1 -1
- data/app/views/manage/cms_snippets/edit.html.erb +1 -1
- data/app/views/management/users/index.html.erb +1 -1
- data/docker-compose.override.yml.example +3 -17
- data/docker-compose.yml +1 -1
- data/lib/extensions/action_controller_extensions.rb +17 -16
- data/lib/imagine_cms/engine.rb +1 -0
- data/lib/imagine_cms/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b10e45eaec58dd97408908218d4e774f886f3dcaa868600c8f13c4e5fac9cb29
|
4
|
+
data.tar.gz: 26d4eacd39df7ff2ff09b25f3dca8e3d64d8519be19399e1d568b5799dbd02f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eacae9beacf1a5ea342dcf6db684fa1d8c1cb1d7e479fdacdd2576d8e9ce4e547a3cc9e42023215a11b16be97282fbf61707c80ef6970c27d077e4de6fe44c4d
|
7
|
+
data.tar.gz: 8536b7f65d30d73123c1a8962ab04166d3d721f14df884930b015fd6a94827fa331a9972d6bda02f46f084007588f5470f3c32a501996d30ecb186dde7d98b6c
|
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)
|
@@ -7,15 +7,21 @@
|
|
7
7
|
Imagine CMS is a web content management system developed by [Bigger Bird Creative, Inc.](https://biggerbird.com) in 2006 for its clients.
|
8
8
|
Other CMSes came with a learning curve: not a problem for daily users, but clients who only used it once a month or so would forget everything by the next time they logged in.
|
9
9
|
Simpler systems didn't have enough functionality to allow us to do what we wanted to do as designers and developers.
|
10
|
-
Thus, we created a CMS that is easy for clients to use, stays out of our way, and provides useful automation (publishing and unpublishing on a schedule, navigation links, RSS feeds, etc.).
|
10
|
+
Thus, we created a CMS that is easy for clients to use, stays out of our way, and provides useful automation (lists, publishing and unpublishing on a schedule, navigation links, RSS feeds, etc.).
|
11
11
|
|
12
12
|
## Current Status
|
13
13
|
|
14
|
-
Imagine
|
14
|
+
[Imagine 6](https://github.com/ImagineCMS/imagine_cms) (Elixir-based) is use in production.
|
15
15
|
|
16
|
-
|
16
|
+
Imagine 5 (this repo) is in use in production, but is being wound down in favor of Imagine 6.
|
17
17
|
|
18
|
-
Imagine
|
18
|
+
Imagine 4 (v4.2-stable branch) is available for apps tied to Rails 4.2, but is no longer actively maintained.
|
19
|
+
|
20
|
+
Imagine 3 (v3.0-stable branch) is available for apps tied to Rails 3.x, but is no longer actively maintained.
|
21
|
+
|
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.
|
23
|
+
|
24
|
+
Imagine 7 (planned) will be a clean break and a great time to try Imagine CMS.
|
19
25
|
|
20
26
|
## History and Roadmap
|
21
27
|
|
@@ -31,15 +37,15 @@ All that is now firmly in the past. By extracting Imagine functionality into a R
|
|
31
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
|
32
38
|
* Imagine 5.0 (Rails 5.0, Ruby 2.2): [SKIPPED] Compatibility with Rails 5.0
|
33
39
|
* Imagine 5.1 (Rails 5.1, Ruby 2.4): [SKIPPED] Compatibility with Rails 5.1
|
34
|
-
* **Imagine 5.2 (Rails 5.2, Ruby 2.5): [
|
35
|
-
* Imagine 6 (
|
36
|
-
* Imagine 7 (
|
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
|
37
43
|
|
38
|
-
Imagine 6
|
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.
|
39
45
|
|
40
46
|
## Hosting
|
41
47
|
|
42
|
-
Imagine 3.x-
|
48
|
+
Imagine 3.x-5.x can run on typical Rails hosting platforms (anything that uses Passenger, Unicorn, Puma, etc.). On hosts that don't allow writing to the local filesystem (e.g. Heroku) you won't be able to use photo galleries or page caching, but other features should work (note: this mode of operation has not been fully tested).
|
43
49
|
|
44
50
|
## Getting Help
|
45
51
|
|
@@ -47,7 +53,7 @@ Get paid support and hosting for Imagine CMS straight from the people who made i
|
|
47
53
|
|
48
54
|
## Contributing
|
49
55
|
|
50
|
-
Imagine 7 (
|
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.
|
51
57
|
|
52
58
|
## Building Docker Image
|
53
59
|
|
@@ -55,7 +61,7 @@ Imagine 7 (Crystal) will be a true open source project, but this project (Ruby-b
|
|
55
61
|
|
56
62
|
```bash
|
57
63
|
docker build -t anamba/imagine5-dev:latest .
|
58
|
-
docker tag anamba/imagine5-dev:latest anamba/imagine5-dev:5.2.
|
64
|
+
docker tag anamba/imagine5-dev:latest anamba/imagine5-dev:5.2.4
|
59
65
|
docker tag anamba/imagine5-dev:latest anamba/imagine5-dev:5.2
|
60
66
|
docker push anamba/imagine5-dev
|
61
67
|
```
|
@@ -249,7 +249,7 @@ function cancelSelectThumbnail() {
|
|
249
249
|
hideDojoDialog('select_thumbnail_dialog');
|
250
250
|
}
|
251
251
|
|
252
|
-
|
252
|
+
if (!window.gallerySize) window.gallerySize = {};
|
253
253
|
function changeGalleryImage(galleryName, index) {
|
254
254
|
var target = galleryName + '_image_' + index;
|
255
255
|
var caption = galleryName + '_caption_' + index;
|
@@ -1,3 +1,11 @@
|
|
1
|
+
// fix for a Firefox 69 issue
|
2
|
+
.dojoFloatingPane {
|
3
|
+
position: fixed !important;
|
4
|
+
top: 40px;
|
5
|
+
left: 50%;
|
6
|
+
margin-left: -25%;
|
7
|
+
}
|
8
|
+
|
1
9
|
.search-result {
|
2
10
|
margin-bottom: 20px;
|
3
11
|
.search-result-title { font-size: 1.1em; }
|
@@ -37,7 +45,7 @@ a.imagine_cms-paginator-link-selected {
|
|
37
45
|
|
38
46
|
/* an extra classname is applied for Opera < 9.0 to fix it's lack of opacity support */
|
39
47
|
.imgCrop_wrap.opera8 .imgCrop_overlay,
|
40
|
-
.imgCrop_wrap.opera8 .imgCrop_clickArea {
|
48
|
+
.imgCrop_wrap.opera8 .imgCrop_clickArea {
|
41
49
|
background-color: transparent;
|
42
50
|
}
|
43
51
|
|
@@ -58,7 +66,7 @@ a.imagine_cms-paginator-link-selected {
|
|
58
66
|
|
59
67
|
.imgCrop_selArea {
|
60
68
|
position: absolute;
|
61
|
-
/* @done_in_js
|
69
|
+
/* @done_in_js
|
62
70
|
top: 20px;
|
63
71
|
left: 20px;
|
64
72
|
width: 200px;
|
@@ -94,16 +102,16 @@ a.imagine_cms-paginator-link-selected {
|
|
94
102
|
z-index: 3;
|
95
103
|
}
|
96
104
|
|
97
|
-
/*
|
105
|
+
/*
|
98
106
|
* FIX MARCHING ANTS IN IE
|
99
|
-
* As IE <6 tries to load background images we can uncomment the follwoing hack
|
107
|
+
* As IE <6 tries to load background images we can uncomment the follwoing hack
|
100
108
|
* to remove that issue, not as pretty - but is anything in IE?
|
101
109
|
* And yes I do know that 'filter' is evil, but it will make it look semi decent in IE
|
102
110
|
*
|
103
111
|
* html .imgCrop_marqueeHoriz,
|
104
112
|
* html .imgCrop_marqueeVert {
|
105
113
|
background: transparent;
|
106
|
-
filter: Invert;
|
114
|
+
filter: Invert;
|
107
115
|
}
|
108
116
|
* html .imgCrop_marqueeNorth { border-top: 1px dashed #000; }
|
109
117
|
* html .imgCrop_marqueeEast { border-right: 1px dashed #000; }
|
@@ -143,7 +151,7 @@ a.imagine_cms-paginator-link-selected {
|
|
143
151
|
cursor: n-resize;
|
144
152
|
}
|
145
153
|
|
146
|
-
.imgCrop_handleNE {
|
154
|
+
.imgCrop_handleNE {
|
147
155
|
top: -3px;
|
148
156
|
right: -3px;
|
149
157
|
cursor: ne-resize;
|
@@ -189,7 +197,7 @@ a.imagine_cms-paginator-link-selected {
|
|
189
197
|
}
|
190
198
|
|
191
199
|
/**
|
192
|
-
* Create an area to click & drag around on as the default browser behaviour is to let you drag the image
|
200
|
+
* Create an area to click & drag around on as the default browser behaviour is to let you drag the image
|
193
201
|
*/
|
194
202
|
.imgCrop_dragArea {
|
195
203
|
width: 100%;
|
@@ -483,7 +483,6 @@ class Manage::CmsPagesController < Manage::ApplicationController
|
|
483
483
|
script_tag = <<-EOT
|
484
484
|
<script type="text/javascript">
|
485
485
|
window.addEventListener('load', (event) => {
|
486
|
-
scanForPageObjects(#{@pg.id}, '#{key}', #{@pg.version});
|
487
486
|
setInterval(function() {
|
488
487
|
scanForPageObjects(#{@pg.id}, '#{key}', #{@pg.version});
|
489
488
|
}, 1000);
|
@@ -491,7 +490,6 @@ class Manage::CmsPagesController < Manage::ApplicationController
|
|
491
490
|
</script>
|
492
491
|
EOT
|
493
492
|
content << script_tag.html_safe
|
494
|
-
# content << observe_field("page_objects_#{key}", function: "scanForPageObjects(#{@pg.id}, '#{key}', #{@pg.version});", frequency: 2)
|
495
493
|
content
|
496
494
|
when :page_list
|
497
495
|
# set defaults unless values are present in template
|
@@ -585,7 +583,7 @@ class Manage::CmsPagesController < Manage::ApplicationController
|
|
585
583
|
FileUtils.cp(data.path(), localfile)
|
586
584
|
end
|
587
585
|
|
588
|
-
|
586
|
+
render json: { filename: File.basename(localfile) }.to_json
|
589
587
|
end
|
590
588
|
|
591
589
|
def crop_image
|
@@ -922,8 +920,8 @@ class Manage::CmsPagesController < Manage::ApplicationController
|
|
922
920
|
end
|
923
921
|
end
|
924
922
|
end
|
925
|
-
|
926
|
-
|
923
|
+
|
924
|
+
render json: { filename: File.basename(localdir) }.to_json
|
927
925
|
end
|
928
926
|
|
929
927
|
def gallery_setup
|
@@ -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
|
@@ -814,17 +802,15 @@ module CmsApplicationHelper
|
|
814
802
|
default_value ||= start_date
|
815
803
|
|
816
804
|
draw_calendar = <<-EOT
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
'&method_prefix=#{method_prefix}', {method:'get', asynchronous:true, evalScripts:true})
|
827
|
-
});
|
805
|
+
new Ajax.Updater('date_picker_#{object}_#{method_prefix}_days',
|
806
|
+
'#{date_picker_url}?month=' + $('#{object}_#{method_prefix}_month_sel').value +
|
807
|
+
'&year=' + $('#{object}_#{method_prefix}_year_sel').value +
|
808
|
+
'&min_time=' + #{start_date.to_i} +
|
809
|
+
'&max_time=' + #{end_date.to_i} +
|
810
|
+
'&exclude_days=#{exclude_days.join(',')}' +
|
811
|
+
'&onchange=#{escape_javascript(options[:onchange])}' +
|
812
|
+
'&object=#{object}' +
|
813
|
+
'&method_prefix=#{method_prefix}', {method:'get', asynchronous:true, evalScripts:true});
|
828
814
|
EOT
|
829
815
|
|
830
816
|
ret = <<-EOT
|
@@ -852,7 +838,17 @@ module CmsApplicationHelper
|
|
852
838
|
</div>
|
853
839
|
</div>
|
854
840
|
EOT
|
855
|
-
ret +=
|
841
|
+
ret += <<-EOT
|
842
|
+
<script type="text/javascript">
|
843
|
+
if (typeof(Ajax) == 'undefined') {
|
844
|
+
window.addEventListener('DOMContentLoaded', (event) => {
|
845
|
+
#{draw_calendar}
|
846
|
+
});
|
847
|
+
} else {
|
848
|
+
#{draw_calendar}
|
849
|
+
}
|
850
|
+
</script>
|
851
|
+
EOT
|
856
852
|
ret.html_safe
|
857
853
|
end
|
858
854
|
|
@@ -1054,7 +1050,7 @@ EOF
|
|
1054
1050
|
|
1055
1051
|
|
1056
1052
|
def cropper_image_tag(options)
|
1057
|
-
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
|
1058
1054
|
ret += javascript_tag("cropper = new Cropper.Img('testImage', { minWidth: 0, minHeight: 0, captureKeys: false, onEndCrop: onEndCrop });")
|
1059
1055
|
end
|
1060
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
|
@@ -5,11 +5,11 @@
|
|
5
5
|
</div>
|
6
6
|
|
7
7
|
<div dojoType="ModalFloatingPane" id="page_browser_dialog" title="Select Page"
|
8
|
-
hasShadow="true" resizable="true" followScroll="false" displayCloseAction="true" style="width:
|
8
|
+
hasShadow="true" resizable="true" followScroll="false" displayCloseAction="true" style="width: 620px; height: 426px;">
|
9
9
|
<div>
|
10
|
-
<div id="page_browser" style="height:
|
10
|
+
<div id="page_browser" style="height: 345px; padding-top: 0px; margin-bottom: 8px;">Loading...</div>
|
11
11
|
|
12
|
-
<input id="page_browser_selection" type="text" class="form" style="width:
|
12
|
+
<input id="page_browser_selection" type="text" class="form" style="width: 516px; padding: 2px;" />
|
13
13
|
<button onclick="closePageBrowser(); return false;" class="form" style="width: 70px">Select</button>
|
14
14
|
</div>
|
15
15
|
</div>
|
@@ -15,7 +15,7 @@
|
|
15
15
|
return readCookie('user_auth_status') == 'authenticated';
|
16
16
|
}
|
17
17
|
</script>
|
18
|
-
<script type="text/javascript"
|
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"
|
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
|
-
|
22
|
+
html = dojo.withGlobal(curInst.window, 'getSelectedHtml', dojo.html.selection);
|
13
23
|
} else {
|
14
|
-
|
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', :
|
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', :
|
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', :
|
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>
|
@@ -18,5 +18,5 @@
|
|
18
18
|
Resize to be at most <%= text_field_tag :max_width, GalleryMaxWidth, :style => 'width: 40px' %> pixels wide and <%= text_field_tag :max_height, GalleryMaxHeight, :style => 'width: 40px' %> pixels high<br/>
|
19
19
|
<%= text_field_tag 'dirname', params[:dirname], :style => 'display: none' %>
|
20
20
|
|
21
|
-
<%= submit_tag 'Finish', :class => 'form_button', :style => 'width: 70px;',
|
21
|
+
<%= submit_tag 'Finish', :class => 'form_button', :style => 'width: 70px;', 'data-disable-with' => 'Please wait...' %>
|
22
22
|
<%- end -%>
|