Sha256: 49107bebcd86f0b49bac833e7e58f3ff03aa53d584d0c0178e27524b64ac20b3

Contents?: true

Size: 714 Bytes

Versions: 13

Compression:

Stored size: 714 Bytes

Contents

module QuickScript
	module Helpers
		def jsify model
			raw (model ? model.to_api.to_json : 'null')
		end

		def jqtpl(name, &block)
			raw "<script id='#{name}' type='text/html'>#{capture(&block)}</script>"
		end

		def include_view_box
			raw "<div data-bind=\"template: {name : getViewBoxTemplate}, attr : {class : 'view-box ' + transition.type}\"></div>"
		end

		def include_quick_script_init(app_model)
			javascript_tag do
				"CURRENT_USER = null;
				appViewModel = null;
				overlay = null;

				$(function() {
					initKO();
					CURRENT_USER = (#{jsify current_user});
					appViewModel = new #{app_model}();
					initApp();
					console.log('Initialized...');
				});".html_safe
			end
		end
	end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
quick_script-0.8.0 lib/quick_script/helpers.rb
quick_script-0.7.0 lib/quick_script/helpers.rb
quick_script-0.5.14 lib/quick_script/helpers.rb
quick_script-0.5.12 lib/quick_script/helpers.rb
quick_script-0.5.11 lib/quick_script/helpers.rb
quick_script-0.5.10 lib/quick_script/helpers.rb
quick_script-0.5.9 lib/quick_script/helpers.rb
quick_script-0.5.7 lib/quick_script/helpers.rb
quick_script-0.5.5 lib/quick_script/helpers.rb
quick_script-0.5.4 lib/quick_script/helpers.rb
quick_script-0.5.3 lib/quick_script/helpers.rb
quick_script-0.5.2 lib/quick_script/helpers.rb
quick_script-0.5.0 lib/quick_script/helpers.rb