Module: Card::Set::Abstract::BootswatchTheme
- Extended by:
- Card::Set
- Defined in:
- tmpsets/set/mod026-bootstrap/abstract/bootswatch_theme.rb,
tmpsets/set/mod026-bootstrap/abstract/bootswatch_theme/html_views.rb
Overview
For the original bootswatch themes all those parts are hard-coded and the content
Defined Under Namespace
Modules: HtmlViews
Constant Summary
collapse
- CONTENT_PARTS =
%i[pre_variables variables post_variables stylesheets].freeze
- PRE_VARIABLES_CARD_NAMES =
%i[
style_jquery_ui_smoothness
bootstrap_functions
].freeze
- POST_VARIABLES_CARD_NAMES =
%i[
bootstrap_core
style_cards
style_bootstrap_cards
style_libraries
style_mods
].freeze
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from I18nScope
#mod_name, #scope
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
#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
#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
#event
Class Method Details
.source_location ⇒ Object
26
|
# File 'tmpsets/set/mod026-bootstrap/abstract/bootswatch_theme.rb', line 26
def self.source_location; "/Users/ethan/dev/decko/gem/card/mod/bootstrap/set/abstract/bootswatch_theme.rb"; end
|
Instance Method Details
#after_engine(output) ⇒ Object
Don't create "+*machine output" file card
instead save the the output as the card's content is
83
84
85
|
# File 'tmpsets/set/mod026-bootstrap/abstract/bootswatch_theme.rb', line 83
def after_engine output
Card::Auth.as_bot { update! db_content: output }
end
|
#content ⇒ Object
107
108
109
110
111
|
# File 'tmpsets/set/mod026-bootstrap/abstract/bootswatch_theme.rb', line 107
def content
CONTENT_PARTS.map do |n|
send "#{n}_content"
end.join "\n"
end
|
reject cards that don't contribute directly to the content like skin or pointer cards
77
78
79
|
# File 'tmpsets/set/mod026-bootstrap/abstract/bootswatch_theme.rb', line 77
def engine_input
extended_input_cards.select { |ca| ca.type_id.in? [ScssID, CssID] }
end
|
#existing_source_paths ⇒ Object
needed to make the refresh_script_and_style method work with these cards
95
96
97
98
99
|
# File 'tmpsets/set/mod026-bootstrap/abstract/bootswatch_theme.rb', line 95
def existing_source_paths
extended_input_cards.map do |i_card|
i_card.try(:existing_source_paths)
end.flatten.compact
end
|
101
102
103
104
105
|
# File 'tmpsets/set/mod026-bootstrap/abstract/bootswatch_theme.rb', line 101
def extended_input_cards
input_names.map do |n|
Card.fetch(n).extended_item_cards
end.flatten.compact
end
|
129
130
131
132
133
134
|
# File 'tmpsets/set/mod026-bootstrap/abstract/bootswatch_theme.rb', line 129
def input_names _args={}
(PRE_VARIABLES_CARD_NAMES + variables_card_names +
POST_VARIABLES_CARD_NAMES + stylesheets_card_names).compact.map do |n|
Card.fetch_name(n)
end.compact
end
|
#item_cards(_args = {}) ⇒ Object
140
141
142
|
# File 'tmpsets/set/mod026-bootstrap/abstract/bootswatch_theme.rb', line 140
def item_cards _args={}
[self]
end
|
#item_names(_args = {}) ⇒ Object
136
137
138
|
# File 'tmpsets/set/mod026-bootstrap/abstract/bootswatch_theme.rb', line 136
def item_names _args={}
[]
end
|
#load_content(*names) ⇒ Object
144
145
146
147
|
# File 'tmpsets/set/mod026-bootstrap/abstract/bootswatch_theme.rb', line 144
def load_content *names
cards = names.flatten.map { |n| Card.fetch(n)&.extended_item_cards }
cards.flatten.compact.map(&:content).join "\n"
end
|
#post_variables_content ⇒ Object
121
122
123
|
# File 'tmpsets/set/mod026-bootstrap/abstract/bootswatch_theme.rb', line 121
def post_variables_content
load_content(*POST_VARIABLES_CARD_NAMES)
end
|
#pre_variables_content ⇒ Object
113
114
115
|
# File 'tmpsets/set/mod026-bootstrap/abstract/bootswatch_theme.rb', line 113
def pre_variables_content
load_content(*PRE_VARIABLES_CARD_NAMES)
end
|
#scss_from_theme_file(file) ⇒ Object
149
150
151
152
153
|
# File 'tmpsets/set/mod026-bootstrap/abstract/bootswatch_theme.rb', line 149
def scss_from_theme_file file
return "" unless (path = ::File.join(source_dir, "_#{file}.scss")) &&
::File.exist?(path)
::File.read path
end
|
#source_dir ⇒ Object
160
161
162
163
|
# File 'tmpsets/set/mod026-bootstrap/abstract/bootswatch_theme.rb', line 160
def source_dir
@source_dir ||=
::File.expand_path "../../../vendor/bootswatch/dist/#{theme_name}", __FILE__
end
|
#source_files ⇒ Object
needed to make the refresh_script_and_style method work with these cards
88
89
90
91
92
|
# File 'tmpsets/set/mod026-bootstrap/abstract/bootswatch_theme.rb', line 88
def source_files
extended_input_cards.map do |i_card|
i_card.try(:source_files)
end.flatten.compact
end
|
#stylesheets_card_names ⇒ Object
72
73
74
|
# File 'tmpsets/set/mod026-bootstrap/abstract/bootswatch_theme.rb', line 72
def stylesheets_card_names
[]
end
|
#stylesheets_content ⇒ Object
125
126
127
|
# File 'tmpsets/set/mod026-bootstrap/abstract/bootswatch_theme.rb', line 125
def stylesheets_content
load_content stylesheets_card_names
end
|
#theme_name ⇒ Object
155
156
157
158
|
# File 'tmpsets/set/mod026-bootstrap/abstract/bootswatch_theme.rb', line 155
def theme_name
/^(.+)_skin$/.match(codename)&.capture(0) ||
/^(.+)[ _][sS]kin/.match(name)&.capture(0)&.downcase
end
|
#variables_card_names ⇒ Object
67
68
69
|
# File 'tmpsets/set/mod026-bootstrap/abstract/bootswatch_theme.rb', line 67
def variables_card_names
[]
end
|
#variables_content ⇒ Object
117
118
119
|
# File 'tmpsets/set/mod026-bootstrap/abstract/bootswatch_theme.rb', line 117
def variables_content
load_content variables_card_names
end
|