billy_cms 0.0.17 → 0.0.18

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dc0d73ca7fa60d20059fdae6eac48d43e9a2eedc
4
- data.tar.gz: 6f57aa43b042cf96b1fe6e9bc0b6d1f1f5ee9797
3
+ metadata.gz: f987c96e0d13b400d49fa9f5056d5e15d899d940
4
+ data.tar.gz: a6b1e0b07f002d25b0a1398b3fb40a2a1d587cd5
5
5
  SHA512:
6
- metadata.gz: 4f2e2f83dda8d78dc19aa59325b4d7f4bd27e98c02c37c80e1222ffec9a8805c59e072d73efe36237c516772fddbb4ec3af5d2d589ad74eb8f471877e311394e
7
- data.tar.gz: 6bb6213c04a9a30e542131c0e9b0dec191ebec900c544923b8b2cfb1c2f991f038b5ca9e2b38e8f70cd5f1d01d46c526493541ffb43b1647e801e029c557f3ba
6
+ metadata.gz: 310fb4a40b442164c1a895d5d27a5a345a82765a93a6e6478d55e72683254d5b1472c1eb5707507a140497a81b1d77e8340f8e6994e91b556f3a3029ed85370e
7
+ data.tar.gz: ac975b4e9087836bfc0c34fe1c22c3f8cca38a1481d97776bffdf296c19079dcdbf73f8a4cb95dccfc763dbcc6bad2d7c2290c739fdafbe6020ce8e68bfcd4dd
@@ -0,0 +1,201 @@
1
+ <html ng-app="BillyCmsBackend" id="billycms-backend-application">
2
+ <head>
3
+ <title>BillyCms:: Backend</title>
4
+ <script src="//cdn.tinymce.com/4/tinymce.min.js"></script>
5
+ <%= stylesheet_link_tag 'https://ajax.googleapis.com/ajax/libs/angular_material/1.0.0-rc1/angular-material.min.css' %>
6
+ <%= stylesheet_link_tag 'application' %>
7
+ <style>
8
+ body {
9
+ background-color: #fff;
10
+ }
11
+ </style>
12
+
13
+ <%= javascript_include_tag 'https://code.jquery.com/jquery-2.1.4.min.js' %>
14
+ <%= javascript_include_tag 'https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js' %>
15
+ <%= javascript_include_tag 'https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-animate.min.js' %>
16
+ <%= javascript_include_tag 'https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-aria.min.js' %>
17
+ <%= javascript_include_tag 'https://ajax.googleapis.com/ajax/libs/angular_material/1.0.0-rc1/angular-material.min.js' %>
18
+ <script>
19
+ /**
20
+ * Binds a TinyMCE widget to <textarea> elements.
21
+ */
22
+ angular.module('ui.tinymce', [])
23
+ .value('uiTinymceConfig', {})
24
+ .directive('uiTinymce', ['$rootScope', '$compile', '$timeout', '$window', '$sce', 'uiTinymceConfig', function($rootScope, $compile, $timeout, $window, $sce, uiTinymceConfig) {
25
+ uiTinymceConfig = uiTinymceConfig || {};
26
+ var generatedIds = 0;
27
+ var ID_ATTR = 'ui-tinymce';
28
+ if (uiTinymceConfig.baseUrl) {
29
+ tinymce.baseURL = uiTinymceConfig.baseUrl;
30
+ }
31
+
32
+ return {
33
+ require: ['ngModel', '^?form'],
34
+ link: function(scope, element, attrs, ctrls) {
35
+ if (!$window.tinymce) {
36
+ return;
37
+ }
38
+
39
+ var ngModel = ctrls[0],
40
+ form = ctrls[1] || null;
41
+
42
+ var expression, options = {}, tinyInstance,
43
+ updateView = function(editor) {
44
+ var content = editor.getContent({format: options.format}).trim();
45
+ content = $sce.trustAsHtml(content);
46
+
47
+ ngModel.$setViewValue(content);
48
+ if (!$rootScope.$$phase) {
49
+ scope.$apply();
50
+ }
51
+ };
52
+
53
+ function toggleDisable(disabled) {
54
+ if (disabled) {
55
+ ensureInstance();
56
+
57
+ if (tinyInstance) {
58
+ tinyInstance.getBody().setAttribute('contenteditable', false);
59
+ }
60
+ } else {
61
+ ensureInstance();
62
+
63
+ if (tinyInstance && !tinyInstance.settings.readonly) {
64
+ tinyInstance.getBody().setAttribute('contenteditable', true);
65
+ }
66
+ }
67
+ }
68
+
69
+ // generate an ID
70
+ attrs.$set('id', ID_ATTR + '-' + generatedIds++);
71
+
72
+ expression = {};
73
+
74
+ angular.extend(expression, scope.$eval(attrs.uiTinymce));
75
+
76
+ var setupOptions = {
77
+ // Update model when calling setContent
78
+ // (such as from the source editor popup)
79
+ setup: function(ed) {
80
+ ed.on('init', function() {
81
+ ngModel.$render();
82
+ ngModel.$setPristine();
83
+ if (form) {
84
+ form.$setPristine();
85
+ }
86
+ });
87
+
88
+ // Update model on button click
89
+ ed.on('ExecCommand', function() {
90
+ ed.save();
91
+ updateView(ed);
92
+ });
93
+
94
+ // Update model on change
95
+ ed.on('change', function() {
96
+ ed.save();
97
+ updateView(ed);
98
+ });
99
+
100
+ ed.on('blur', function() {
101
+ element[0].blur();
102
+ });
103
+
104
+ // Update model when an object has been resized (table, image)
105
+ ed.on('ObjectResized', function() {
106
+ ed.save();
107
+ updateView(ed);
108
+ });
109
+
110
+ ed.on('remove', function() {
111
+ element.remove();
112
+ });
113
+
114
+ if (expression.setup) {
115
+ expression.setup(ed, {
116
+ updateView: updateView
117
+ });
118
+ }
119
+ },
120
+ format: expression.format || 'html',
121
+ selector: '#' + attrs.id
122
+ };
123
+ // extend options with initial uiTinymceConfig and
124
+ // options from directive attribute value
125
+ angular.extend(options, uiTinymceConfig, expression, setupOptions);
126
+ // Wrapped in $timeout due to $tinymce:refresh implementation, requires
127
+ // element to be present in DOM before instantiating editor when
128
+ // re-rendering directive
129
+ $timeout(function() {
130
+ tinymce.init(options);
131
+ toggleDisable(scope.$eval(attrs.ngDisabled));
132
+ });
133
+
134
+ ngModel.$formatters.unshift(function(modelValue) {
135
+ return modelValue ? $sce.trustAsHtml(modelValue) : '';
136
+ });
137
+
138
+ ngModel.$parsers.unshift(function(viewValue) {
139
+ return viewValue ? $sce.getTrustedHtml(viewValue) : '';
140
+ });
141
+
142
+ ngModel.$render = function() {
143
+ ensureInstance();
144
+
145
+ var viewValue = ngModel.$viewValue ?
146
+ $sce.getTrustedHtml(ngModel.$viewValue) : '';
147
+
148
+ // instance.getDoc() check is a guard against null value
149
+ // when destruction & recreation of instances happen
150
+ if (tinyInstance &&
151
+ tinyInstance.getDoc()
152
+ ) {
153
+ tinyInstance.setContent(viewValue);
154
+ // Triggering change event due to TinyMCE not firing event &
155
+ // becoming out of sync for change callbacks
156
+ tinyInstance.fire('change');
157
+ }
158
+ };
159
+
160
+ attrs.$observe('disabled', toggleDisable);
161
+
162
+ // This block is because of TinyMCE not playing well with removal and
163
+ // recreation of instances, requiring instances to have different
164
+ // selectors in order to render new instances properly
165
+ scope.$on('$tinymce:refresh', function(e, id) {
166
+ var eid = attrs.id;
167
+ if (angular.isUndefined(id) || id === eid) {
168
+ var parentElement = element.parent();
169
+ var clonedElement = element.clone();
170
+ clonedElement.removeAttr('id');
171
+ clonedElement.removeAttr('style');
172
+ clonedElement.removeAttr('aria-hidden');
173
+ tinymce.execCommand('mceRemoveEditor', false, eid);
174
+ parentElement.append($compile(clonedElement)(scope));
175
+ }
176
+ });
177
+
178
+ scope.$on('$destroy', function() {
179
+ ensureInstance();
180
+
181
+ if (tinyInstance) {
182
+ tinyInstance.remove();
183
+ tinyInstance = null;
184
+ }
185
+ });
186
+
187
+ function ensureInstance() {
188
+ if (!tinyInstance) {
189
+ tinyInstance = tinymce.get(attrs.id);
190
+ }
191
+ }
192
+ }
193
+ };
194
+ }]);
195
+ </script>
196
+ <%= javascript_include_tag 'billy_cms/backend' %>
197
+ </head>
198
+ <body>
199
+ <%= yield %>
200
+ </body>
201
+ </html>
@@ -1,3 +1,3 @@
1
1
  module BillyCms
2
- VERSION = "0.0.17"
2
+ VERSION = "0.0.18"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: billy_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.17
4
+ version: 0.0.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - unsdrei GbR
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-12-11 00:00:00.000000000 Z
11
+ date: 2016-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -174,6 +174,7 @@ files:
174
174
  - app/views/billy_cms/backend/_page_types.html.erb
175
175
  - app/views/billy_cms/backend/_tree.html.erb
176
176
  - app/views/billy_cms/backend/index.html.erb
177
+ - app/views/layouts/billy_cms/backend.html.erb
177
178
  - billy_cms.gemspec
178
179
  - bin/console
179
180
  - bin/setup