Module: Card::Set::All::History::Actions
- Extended by:
- Card::Set
- Defined in:
- tmpsets/set/mod005-history/all/history/actions.rb
Overview
Set: All cards (History, Actions)
-- encoding : utf-8 --
Defined Under Namespace
Modules: HtmlFormat
Class Method Summary collapse
Instance Method Summary collapse
- #action_from_id(action_id) ⇒ Object
- #all_action_ids ⇒ Object
- #create_action ⇒ Object
- #current_action_changes_content? ⇒ Boolean
- #new_content_action_id ⇒ Object
- #nth_action(index) ⇒ Object
- #old_actions ⇒ Object
Methods included from I18nScope
Methods included from Loader
#clean_empty_module_from_hash, #clean_empty_modules, #extended, #process_base_modules, #register_set
Methods included from Helpers
#abstract_set?, #all_set?, #num_set_parts, #shortname, #underscore
Methods included from Card::Set::AdvancedApi
#attachment, #ensure_set, #stage_method
Methods included from Format
#before, #format, layout_method_name, #view, view_method_name, view_setting_method_name, wrapper_method_name
Methods included from Inheritance
#include_set, #include_set_formats
Methods included from Basket
#abstract_basket, #add_to_basket, #basket, #unshift_basket
Methods included from Trait
#card_accessor, #card_reader, #card_writer, #require_field
Methods included from Event::Api
Class Method Details
.source_location ⇒ Object
8 |
# File 'tmpsets/set/mod005-history/all/history/actions.rb', line 8 def self.source_location; "/Users/ethan/dev/decko/gem/card/mod/history/set/all/history/actions.rb"; end |
Instance Method Details
#action_from_id(action_id) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'tmpsets/set/mod005-history/all/history/actions.rb', line 14 def action_from_id action_id return unless action_id.is_a?(Integer) || action_id =~ /^\d+$/ # if not an integer revision id is probably a mod (e.g. if you request # files/:logo/standard.png) action = Action.fetch action_id return unless action.card_id == id action end |
#all_action_ids ⇒ Object
10 11 12 |
# File 'tmpsets/set/mod005-history/all/history/actions.rb', line 10 def all_action_ids Card::Action.where(card_id: id).pluck :id end |
#create_action ⇒ Object
29 30 31 |
# File 'tmpsets/set/mod005-history/all/history/actions.rb', line 29 def create_action @create_action ||= actions.first end |
#current_action_changes_content? ⇒ Boolean
47 48 49 |
# File 'tmpsets/set/mod005-history/all/history/actions.rb', line 47 def current_action_changes_content? new_card? || @current_action.new_content? || db_content_is_changing? end |
#new_content_action_id ⇒ Object
41 42 43 44 45 |
# File 'tmpsets/set/mod005-history/all/history/actions.rb', line 41 def new_content_action_id return unless @current_action && current_action_changes_content? @current_action.id end |
#nth_action(index) ⇒ Object
33 34 35 36 37 38 39 |
# File 'tmpsets/set/mod005-history/all/history/actions.rb', line 33 def nth_action index index = index.to_i return unless id && index.positive? Action.where("draft is not true AND card_id = #{id}") .order(:id).limit(1).offset(index - 1).first end |
#old_actions ⇒ Object
25 26 27 |
# File 'tmpsets/set/mod005-history/all/history/actions.rb', line 25 def old_actions actions.where("id != ?", last_action_id) end |