Class: Kea::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Kea::InstallGenerator
- Defined in:
- lib/generators/kea/install/install_generator.rb
Instance Method Summary collapse
- #application_css ⇒ Object
- #application_js ⇒ Object
- #directories ⇒ Object
- #global_initializer ⇒ Object
- #helpers ⇒ Object
- #init_js ⇒ Object
- #layout_setup ⇒ Object
- #main_viewmodel ⇒ Object
Instance Method Details
#application_css ⇒ Object
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
# File 'lib/generators/kea/install/install_generator.rb', line 103 def application_css copy_file "_komplete.sass", namespaced_path("app/assets/stylesheets", "_komplete.sass") copy_file "_sherlock.sass", namespaced_path("app/assets/stylesheets", "_sherlock.sass") insert_into_file namespaced_path("app/assets/stylesheets", "application.css.sass"), "*= require kea/kea\n", :before => "*= require_self" append_to_file namespaced_path("app/assets/stylesheets", "application.css.sass") do <<-'CSS' +keyframes(overlay) 0% +transform(translateY(-100%) scale(0.8)) box-shadow: 0px 40px 20px 5px $grey-20 50% +transform(translateY(0%) scale(0.8)) box-shadow: 0px 0px 20px 5px $grey-20 90% +transform(translateY(0%) scale(0.8)) box-shadow: 0px 0px 20px 5px $grey-20 100% +transform(translateY(0%) scale(1)) box-shadow: 0px 0px 0px 0px $grey-20 // Imported elements @import sherlock @import komplete .attache-popover display: none position: absolute z-index: 2 padding: 1em opacity: 0 transition: opacity 0.3s ease +triangles(grey) &.inactive display: none &.activating, &.active display: block &.active opacity: 1 &.formerror z-index: 11 background: opacify(red, 0.3) border-color: red color: white +triangles(opacify(red, 0.3)) .veil-overlay position: fixed top: 0 left: 0 display: none z-index: 10 // +transition(all 1s $cubic-transition) // +transform(scale(0.5)) &.fullscreen width: 100% height: 100vh padding: 2rem &.activating, &.active, &.deactivating display: block visibility: visible &.active +animation(overlay 1s $cubic-transition 0s 1 normal forwards) &.deactivating +transform(scale(0)) // +animation(overlay 1s $cubic-transition 0s 1 reverse forwards) CSS end end |
#application_js ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/generators/kea/install/install_generator.rb', line 32 def application_js insert_into_file namespaced_path("app/assets/javascripts", "application.js"), :after => "jquery_ujs\n" do <<-'JS' //= require kea/kea_dependencies //= require ./init //= require kea/kea //= require_directory ./bindings //= require_directory ./extenders //= require_directory ./models //= require_directory ./services //= require ./viewmodels/main //= require_directory ./viewmodels //= require_directory ./sherlock //= require_directory ./initializers JS end append_to_file namespaced_path("app/assets/javascripts", "application.js") do <<-'JS' $(document).ready(function() { "use strict"; $.ajaxSetup({ timeout: 30000 }); window.app.page.MainVm = new window.app.viewmodels.Main(); var $body = $('body'); app.initializers.forEach(function(initializer) { if (initializer.selectors.length === 0) { initializer.callback(); return; } initializer.selectors.forEach(function(selector) { if (selector.charAt(0) === '#') { if ($body.attr('id') === selector.slice(1, selector.length)) { initializer.callback(); } } else if (selector.charAt(0) === '.') { if ($body.hasClass(selector)) { initializer.callback(); } } }); }); ko.applyBindings(app.page.MainVm); app.page.MainVm.pageInitComplete(true); if (app.errors.length > 0) { app.errors.forEach(function(error) { kea.notify(error.message, error.level); }); } }); JS end end |
#directories ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/generators/kea/install/install_generator.rb', line 9 def directories empty_directory namespaced_path("app/assets/javascripts", "bindings") create_file namespaced_path("app/assets/javascripts", "bindings/.keep") empty_directory namespaced_path("app/assets/javascripts", "extenders") create_file namespaced_path("app/assets/javascripts", "extenders/.keep") empty_directory namespaced_path("app/assets/javascripts", "initializers") empty_directory namespaced_path("app/assets/javascripts", "models") create_file namespaced_path("app/assets/javascripts", "models/.keep") empty_directory namespaced_path("app/assets/javascripts", "services") create_file namespaced_path("app/assets/javascripts", "services/.keep") empty_directory namespaced_path("app/assets/javascripts", "viewmodels") empty_directory namespaced_path("app/assets/javascripts", "sherlock") create_file namespaced_path("app/assets/javascripts", "sherlock/.keep") end |
#global_initializer ⇒ Object
24 25 26 |
# File 'lib/generators/kea/install/install_generator.rb', line 24 def global_initializer copy_file "global.js", namespaced_path("app/assets/javascripts/", "initializers/global.js") end |
#helpers ⇒ Object
178 179 180 181 182 |
# File 'lib/generators/kea/install/install_generator.rb', line 178 def helpers inject_into_class "app/controllers/application_controller.rb", ApplicationController do " helper Kea::ApplicationHelper\n" end end |
#init_js ⇒ Object
5 6 7 |
# File 'lib/generators/kea/install/install_generator.rb', line 5 def init_js copy_file "init.js", namespaced_path("app/assets/javascripts/", "init.js") end |
#layout_setup ⇒ Object
174 175 176 |
# File 'lib/generators/kea/install/install_generator.rb', line 174 def layout_setup copy_file "application.html.erb", "app/views/layouts/#{namespace ? namespace.underscore : "application"}.html.erb" end |
#main_viewmodel ⇒ Object
28 29 30 |
# File 'lib/generators/kea/install/install_generator.rb', line 28 def main_viewmodel copy_file "main.js", namespaced_path("app/assets/javascripts/", "viewmodels/main.js") end |