[Git][noosfero/noosfero][next] Deleted 2 commits: added 'restricted' mode to tinymce
Daniela Feitosa
gitlab at mg.gitlab.com
Tue Nov 10 20:31:40 BRST 2015
Daniela Feitosa pushed to branch next at Noosfero / noosfero
WARNING: The push did not contain any new commits, but force pushed to delete the commits and changes below.
Deleted commits:
d1efbf3e by Marcos Ronaldo at 2015-11-05T12:16:28Z
added 'restricted' mode to tinymce
Signed-off-by: Gabriel Silva <gabriel93.silva at gmail.com>
Signed-off-by: Luciano Prestes <lucianopcbr at gmail.com>
Signed-off-by: Marcos Ronaldo <marcos.rpj2 at gmail.com>
- - - - -
c282ae3c by Daniela Feitosa at 2015-11-10T22:27:29Z
Merge branch 'tinymce_links' into 'next'
Tinymce links
fix some paths adding noosfero root to them.
See merge request !709
- - - - -
7 changed files:
- app/helpers/tinymce_helper.rb
- + features/step_definitions/tiny_mce_steps.rb
- + features/tiny_mce.feature
- + plugins/environment_notification/features/message_edition.feature
- plugins/environment_notification/public/environment_notification_plugin.js
- plugins/environment_notification/views/environment_notification_plugin_admin/_form.html.erb
- public/javascripts/tinymce/js/tinymce/tinymce.js
Changes:
=====================================
app/helpers/tinymce_helper.rb
=====================================
--- a/app/helpers/tinymce_helper.rb
+++ b/app/helpers/tinymce_helper.rb
@@ -20,18 +20,9 @@ module TinymceHelper
:image_advtab => true,
:language => tinymce_language
- options[:toolbar1] = "fullscreen | insertfile undo redo | copy paste | bold italic underline | styleselect fontsizeselect | forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image"
- if options[:mode] == 'simple'
- options[:menubar] = false
- else
- options[:menubar] = 'edit insert view tools'
- options[:toolbar2] = 'print preview code media | table'
-
- options[:toolbar2] += ' | macros'
- macros_with_buttons.each do |macro|
- options[:toolbar2] += " #{macro.identifier}"
- end
- end
+ options[:toolbar1] = toolbar1(options[:mode])
+ options[:menubar] = menubar(options[:mode])
+ options[:toolbar2] = toolbar2(options[:mode])
options[:macros_setup] = macros_with_buttons.map do |macro|
<<-EOS
@@ -49,4 +40,29 @@ module TinymceHelper
"noosfero.tinymce.init(#{options.to_json})"
end
+ def menubar mode
+ if mode =='restricted' || mode == 'simple'
+ return false
+ end
+ return 'edit insert view tools'
+ end
+
+ def toolbar1 mode
+ if mode == 'restricted'
+ return "bold italic underline | link"
+ end
+ return "fullscreen | insertfile undo redo | copy paste | bold italic underline | styleselect fontsizeselect | forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image"
+ end
+
+ def toolbar2 mode
+ if mode.blank?
+ toolbar2 = 'print preview code media | table'
+ toolbar2 += ' | macros'
+ macros_with_buttons.each do |macro|
+ toolbar2 += " #{macro.identifier}"
+ end
+ return toolbar2
+ end
+ end
+
end
=====================================
features/step_definitions/tiny_mce_steps.rb
=====================================
--- /dev/null
+++ b/features/step_definitions/tiny_mce_steps.rb
@@ -0,0 +1,9 @@
+Then /^The tinymce "(.+)" should be "(.+)"$/ do |item, content|
+ item_value = page.evaluate_script("tinyMCE.activeEditor.getParam('#{item}');")
+ assert_equal item_value.to_s, content
+end
+
+Then /^The tinymce "(.+)" should contain "(.+)"$/ do |item, content|
+ item_value = page.evaluate_script("tinyMCE.activeEditor.getParam('#{item}');")
+ assert_include item_value.to_s, content
+end
=====================================
features/tiny_mce.feature
=====================================
--- /dev/null
+++ b/features/tiny_mce.feature
@@ -0,0 +1,19 @@
+Feature: Create tinyMCE article
+ As an ordinary user
+ I want to create an tinymce
+
+ Background:
+ Given the following users
+ | login | name |
+ | joaosilva | joao silva |
+ Given I am logged in as "joaosilva"
+
+ @selenium
+ Scenario: mce complete mode should show on message creation
+ Given I am on joaosilva's control panel
+ And I follow "Manage Content"
+ And I follow "New content"
+ And I follow "Text article with visual editor"
+ Then The tinymce "toolbar1" should be "fullscreen | insertfile undo redo | copy paste | bold italic underline | styleselect fontsizeselect | forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image"
+ And The tinymce "menubar" should be "edit insert view tools"
+ And The tinymce "toolbar2" should contain "print preview code media | table"
=====================================
plugins/environment_notification/features/message_edition.feature
=====================================
--- /dev/null
+++ b/plugins/environment_notification/features/message_edition.feature
@@ -0,0 +1,14 @@
+Feature: Create envronment notification message
+ As an admin user
+ I want to create an environment notification
+ In order to notificate users
+
+ @selenium
+ Scenario: mce restricted mode should show on message creation
+ Given I am logged in as admin
+ And I follow "Administration"
+ And I follow "Plugins"
+ And I follow "Configuration"
+ And I follow "New Notification"
+ Then The tinymce "toolbar1" should be "bold italic underline | link"
+ Then The tinymce "menubar" should be "false"
=====================================
plugins/environment_notification/public/environment_notification_plugin.js
=====================================
--- a/plugins/environment_notification/public/environment_notification_plugin.js
+++ b/plugins/environment_notification/public/environment_notification_plugin.js
@@ -53,17 +53,6 @@
}
},
- mceRestrict: function() {
- tinyMCE.init({
- menubar : false,
- selector: "textarea",
- plugins: [
- "autolink link"
- ],
- toolbar: "bold italic underline | link"
- });
- },
-
showPopup: function() {
if($('.action-home-index').length > 0) {
jQuery(function($){
@@ -83,10 +72,6 @@
$(".environment-notification-plugin-notification-bar .notification-close").on("click", environment_notification_plugin.closeNotification);
$(".environment-notification-plugin-notification-bar .notification-hide").on("click", environment_notification_plugin.hideNotification);
- if($('.environment-notification-plugin-message').length > 0){
- environment_notification_plugin.mceRestrict();
- }
-
if($('.environment-notification-plugin-notification-bar').length > 0){
environment_notification_plugin.hideUserNotification();
}
@@ -96,4 +81,4 @@
}
});
-})($);
\ No newline at end of file
+})($);
=====================================
plugins/environment_notification/views/environment_notification_plugin_admin/_form.html.erb
=====================================
--- a/plugins/environment_notification/views/environment_notification_plugin_admin/_form.html.erb
+++ b/plugins/environment_notification/views/environment_notification_plugin_admin/_form.html.erb
@@ -1,11 +1,12 @@
<div class="environment-notification-plugin-form">
- <% abstract_options = {:value => @notification.message, :style => 'width: 100%; height: 200px;', :class => "environment-notification-plugin-message" } %>
+
+ <% abstract_options = {:value => @notification.message, :style => 'width: 100%; height: 200px;', :class => 'mceEditor'} %>
<%= button :back, _('Back'), :controller => 'environment_notification_plugin_admin' %>
<%= form_for :notifications do |f| %>
- <%= render :file => 'shared/tiny_mce' %>
+ <%= render :file => 'shared/tiny_mce', :locals => {:mode => 'restricted'} %>
<%= labelled_form_field(_("Optional Title:"), f.text_field(:title, value: @notification.title)) %>
=====================================
public/javascripts/tinymce/js/tinymce/tinymce.js
=====================================
--- a/public/javascripts/tinymce/js/tinymce/tinymce.js
+++ b/public/javascripts/tinymce/js/tinymce/tinymce.js
@@ -82,7 +82,7 @@
target[fragments[fragments.length - 1]] = modules[id];
}
-
+
// Expose private modules for unit tests
if (exports.AMDLC_TESTS) {
privateModules = exports.privateModules || {};
@@ -40368,4 +40368,4 @@ define("tinymce/ui/Throbber", [
});
expose(["tinymce/dom/EventUtils","tinymce/dom/Sizzle","tinymce/Env","tinymce/util/Tools","tinymce/dom/DomQuery","tinymce/html/Styles","tinymce/dom/TreeWalker","tinymce/html/Entities","tinymce/dom/DOMUtils","tinymce/dom/ScriptLoader","tinymce/AddOnManager","tinymce/dom/RangeUtils","tinymce/html/Node","tinymce/html/Schema","tinymce/html/SaxParser","tinymce/html/DomParser","tinymce/html/Writer","tinymce/html/Serializer","tinymce/dom/Serializer","tinymce/util/VK","tinymce/dom/ControlSelection","tinymce/dom/BookmarkManager","tinymce/dom/Selection","tinymce/Formatter","tinymce/UndoManager","tinymce/EditorCommands","tinymce/util/URI","tinymce/util/Class","tinymce/util/EventDispatcher","tinymce/util/Observable","tinymce/ui/Selector","tinymce/ui/Collection","tinymce/ui/ReflowQueue","tinymce/ui/Control","tinymce/ui/Factory","tinymce/ui/KeyboardNavigation","tinymce/ui/Container","tinymce/ui/DragHelper","tinymce/ui/Scrollable","tinymce/ui/Panel","tinymce/ui/Movable","tinymce/ui/Resizable","tinymce/ui/FloatPanel","tinymce/ui/Window","tinymce/ui/MessageBox","tinymce/WindowManager","tinymce/EditorObservable","tinymce/Shortcuts","tinymce/util/Promise","tinymce/Editor","tinymce/util/I18n","tinymce/FocusManager","tinymce/EditorManager","tinymce/util/XHR","tinymce/util/JSON","tinymce/util/JSONRequest","tinymce/util/JSONP","tinymce/util/LocalStorage","tinymce/Compat","tinymce/ui/Layout","tinymce/ui/AbsoluteLayout","tinymce/ui/Tooltip","tinymce/ui/Widget","tinymce/ui/Button","tinymce/ui/ButtonGroup","tinymce/ui/Checkbox","tinymce/ui/ComboBox","tinymce/ui/ColorBox","tinymce/ui/PanelButton","tinymce/ui/ColorButton","tinymce/util/Color","tinymce/ui/ColorPicker","tinymce/ui/Path","tinymce/ui/ElementPath","tinymce/ui/FormItem","tinymce/ui/Form","tinymce/ui/FieldSet","tinymce/ui/FilePicker","tinymce/ui/FitLayout","tinymce/ui/FlexLayout","tinymce/ui/FlowLayout","tinymce/ui/FormatControls","tinymce/ui/GridLayout","tinymce/ui/Iframe","tinymce/ui/Label","tinymce/ui/Toolbar","tinymce/ui/MenuBar","tinymce/ui/MenuButton","tinymce/ui/MenuItem","tinymce/ui/Menu","tinymce/ui/ListBox","tinymce/ui/Radio","tinymce/ui/Rect","tinymce/ui/ResizeHandle","tinymce/ui/Slider","tinymce/ui/Spacer","tinymce/ui/SplitButton","tinymce/ui/StackLayout","tinymce/ui/TabPanel","tinymce/ui/TextBox","tinymce/ui/Throbber"]);
-})(this);
\ No newline at end of file
+})(this);
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/ae133d6f1714103881fee45272c141d699d3f1c7...c282ae3ca5a8aa033fe70a96cbedaa405f383146
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20151110/122d6987/attachment.html>
More information about the Noosfero-dev
mailing list