Module: Plugins::PostReorder::PostReorderHelper
- Defined in:
- app/helpers/plugins/post_reorder/post_reorder_helper.rb
Overview
Camaleon CMS is a content management system
Copyright (C) 2015 by Owen Peredo Diaz
Email: [email protected]
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Affero General Public License (GPLv3) for more details.
Instance Method Summary collapse
-
#get_plugin ⇒ Object
get the plugin name with slug: ‘post_reorder’.
-
#post_reorder_on_active(plugin) ⇒ Object
here all actions on going to active you can run sql commands like this: results = ActiveRecord::Base.connection.execute(query); plugin: plugin model.
- #post_reorder_on_destroy(plugin) ⇒ Object
-
#post_reorder_on_inactive(plugin) ⇒ Object
here all actions on going to inactive plugin: plugin model.
-
#post_reorder_on_list_post(values) ⇒ Object
This adds a javascript to rearrange the elements of any type of content.
-
#post_reorder_plugin_options(arg) ⇒ Object
This will add link options for this plugin.
Instance Method Details
#get_plugin ⇒ Object
get the plugin name with slug: ‘post_reorder’
12 13 14 |
# File 'app/helpers/plugins/post_reorder/post_reorder_helper.rb', line 12 def get_plugin plugin = current_site.plugins.find_by_slug("post_reorder") end |
#post_reorder_on_active(plugin) ⇒ Object
here all actions on going to active you can run sql commands like this: results = ActiveRecord::Base.connection.execute(query); plugin: plugin model
24 25 |
# File 'app/helpers/plugins/post_reorder/post_reorder_helper.rb', line 24 def post_reorder_on_active(plugin) end |
#post_reorder_on_destroy(plugin) ⇒ Object
16 17 18 |
# File 'app/helpers/plugins/post_reorder/post_reorder_helper.rb', line 16 def post_reorder_on_destroy(plugin) end |
#post_reorder_on_inactive(plugin) ⇒ Object
here all actions on going to inactive plugin: plugin model
29 30 31 |
# File 'app/helpers/plugins/post_reorder/post_reorder_helper.rb', line 29 def post_reorder_on_inactive(plugin) end |
#post_reorder_on_list_post(values) ⇒ Object
This adds a javascript to rearrange the elements of any type of content
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'app/helpers/plugins/post_reorder/post_reorder_helper.rb', line 34 def post_reorder_on_list_post(values) = get_plugin.('_reorder_objects') if .present? [:post_type].each do || if .to_i == values[:post_type].id.to_i append_asset_libraries({reorder: {js: [plugin_gem_asset("reorder.js")], css: [plugin_gem_asset("reorder.css")]}}) content_append('<script> run.push(function(){ $.fn.reorder({url: "'+admin_plugins_post_reorder_reorder_posts_path+'", table: "#posts-table-list"}); }); </script>') end end end end |
#post_reorder_plugin_options(arg) ⇒ Object
This will add link options for this plugin.
53 54 55 |
# File 'app/helpers/plugins/post_reorder/post_reorder_helper.rb', line 53 def (arg) arg[:links] << link_to(t('plugin.post_reorder.settings'), admin_plugins_post_reorder_settings_path) end |