lalala 4.1.0.dev.367 → 4.1.0.dev.375

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5448909848bb92e4e6e4cc22becb7da4c7180c87
4
- data.tar.gz: 4595f74a1e5aa5986144e1e6341716b989605dba
3
+ metadata.gz: e1d34d1c361064e510944ffb7b0ce52d6d20f4f9
4
+ data.tar.gz: 03d51ab2417ca99c743db05d01b8ea13b323d6dc
5
5
  SHA512:
6
- metadata.gz: 304e5cb98e42ef5082c2218a98eca36dc92081683c091db62ce0c2f64b389ca4e329c8b2ab4dd8ba62f90ff228123165367799e8b4bb4259b313114a5fe9d55e
7
- data.tar.gz: 004f96ef88ab98f2fec6ace4b51f86c9afeaa73d0924cf89c63c413b35b2e8e8ca940ad0fbd1fca3db27e9e633ccc240d5be98eddd21de073b03dd2535cbd43a
6
+ metadata.gz: ccf21de93636159e713e0a068f0ade9004ee0d0b038e5b64a7519f67f0e01091517b98e0eb1bd5256bc61d07fe83c970e862e2cf281cb90fa286398fe149c20d
7
+ data.tar.gz: e09709e468e99776476ef304b59694c28e386e4d88e45bd27982d3608692d664301016cbdd230f06fc0e9072372b64190d691d215e1e0a65da401082a316149e
@@ -22,6 +22,7 @@ function setup() {
22
22
  $markitup_wrapper.find('.close-fullscreen').click(close_fullscreen);
23
23
  $markitup_wrapper.find('.markdown-cheatsheet').click(toggle_cheatsheet);
24
24
  $markitup_wrapper.find('.add-image').click(add_image_click_handler);
25
+ $('body').on('click', '.markdown-cheatsheet-close', toggle_cheatsheet);
25
26
  }
26
27
 
27
28
 
@@ -33,18 +34,25 @@ function open_fullscreen(event) {
33
34
  var $markitup_wrapper = $(this).closest('.markItUp');
34
35
  $markitup_wrapper.find('.markItUpHeader .preview').trigger('mouseup');
35
36
  $markitup_wrapper.addClass('fullscreen');
36
- }
37
37
 
38
+ $('body').on('keyup.MARKDOWN_FULLSCREEN', function (event) {
39
+ if (event.which === 27) {
40
+ close_fullscreen(event);
41
+ }
42
+ });
43
+ }
38
44
 
45
+ //
46
+ // Close fullscreen
47
+ //
39
48
  function close_fullscreen(event) {
40
- var $markitup_wrapper = $(this).closest('.markItUp');
49
+ var $markitup_wrapper = $('.close-fullscreen').closest('.markItUp');
41
50
  $markitup_wrapper.removeClass('fullscreen');
51
+ $('body').off('keyup.MARKDOWN_FULLSCREEN');
42
52
  }
43
53
 
44
-
45
-
46
54
  //
47
- // Cheatsheet
55
+ // Toggle Markdown cheatsheet
48
56
  //
49
57
  function toggle_cheatsheet(event) {
50
58
  var $markdown_cheatsheet = $('#markdown-cheatsheet');
@@ -64,7 +72,9 @@ function toggle_cheatsheet(event) {
64
72
  }
65
73
  }
66
74
 
67
-
75
+ //
76
+ // Load Markdown syntax cheatsheet
77
+ //
68
78
  function load_cheatsheat(options) {
69
79
  $.get('/lalala/markdown/cheatsheet', function(data) {
70
80
  var $div = $('<div id="markdown-cheatsheet" />');
@@ -81,8 +91,6 @@ function load_cheatsheat(options) {
81
91
  });
82
92
  }
83
93
 
84
-
85
-
86
94
  //
87
95
  // Images
88
96
  //
@@ -1,6 +1,6 @@
1
1
  #markdown-cheatsheet {
2
2
  @include box-shadow(0 0 10px gray(100));
3
- background-color: rgba(255,255,255, 0.95);
3
+ background-color: #fff;
4
4
  bottom: 0;
5
5
  overflow: auto;
6
6
  padding: 15px;
@@ -42,4 +42,20 @@
42
42
 
43
43
  }
44
44
 
45
+ .markdown-cheatsheet-close {
46
+ @include transition(color 220ms ease-in-out);
47
+ font-size: 20px;
48
+ font-weight: 100;
49
+ text-decoration: none;
50
+ color: rgba(0, 0, 0, 0.45);
51
+ position: absolute;
52
+ right: 10px;
53
+ padding: 10px;
54
+ top: 10px;
55
+
56
+ &:hover {
57
+ color: rgba(0, 0, 0, 1);
58
+ }
59
+ }
60
+
45
61
  }
@@ -1,3 +1,5 @@
1
+ <a href="#" class="markdown-cheatsheet-close">&times;</a>
2
+
1
3
  <h2>Markdown Cheatsheet:</h2>
2
4
 
3
5
  <a href="http://daringfireball.net/projects/markdown/syntax" target="_blank">
@@ -4,7 +4,7 @@
4
4
  "version": "0.0.1",
5
5
  "main": "javascripts/application.js",
6
6
  "dependencies": {
7
- "jquery": "~1.10.2",
7
+ "jquery": "~1",
8
8
  "modernizr": "~2.7.1",
9
9
  "respond": "~1.4.2",
10
10
  "normalize-scss": "~2.1.3"
@@ -63,6 +63,19 @@ module Lalala
63
63
  gsub_file "config/environments/production.rb", " # config.assets.precompile += %w( search.js )", " config.assets.precompile += %w( modernizr.js )"
64
64
  end
65
65
 
66
+ def setup_helpers
67
+ empty_directory "app/helpers"
68
+ copy_file "helpers/application_helper.rb", "app/helpers/application_helper.rb"
69
+ template "helpers/open_graph_helper.rb.erb", "app/helpers/open_graph_helper.rb"
70
+ copy_file "helpers/html_helper.rb", "app/helpers/html_helper.rb"
71
+ copy_file "helpers/pages_helper.rb", "app/helpers/pages_helper.rb"
72
+ end
73
+
74
+ def setup_locales
75
+ empty_directory 'config/locales'
76
+ copy_file 'locales/en.yml', 'config/locales/en.yml'
77
+ end
78
+
66
79
  def setup_forklift
67
80
  empty_directory ".forklift"
68
81
  end
@@ -0,0 +1,64 @@
1
+ <!DOCTYPE html>
2
+ <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
3
+ <!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
4
+ <!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
5
+ <!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
6
+ <head>
7
+ <meta charset="utf-8">
8
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
9
+
10
+ <title><%= og_title %></title>
11
+
12
+ <meta name="viewport" content="width=device-width, initial-scale=1, minimal-ui" />
13
+
14
+ <meta name="description" content="<%= og_description %>" />
15
+ <meta name="distribution" content="global" />
16
+ <%= meta_name_robots %>
17
+ <meta name="revisit-after" content="31 days" />
18
+ <meta name="author" content="" />
19
+ <meta name="publisher" content="Mr. Henry" />
20
+ <meta name="copyright" content="" />
21
+
22
+ <link rel="shortcut icon" href="/assets/favicon.ico"/>
23
+ <link rel="canonical" href="<%= canonical_url(request.original_fullpath) %>" />
24
+
25
+ <meta property="og:url" content="<%= canonical_url(request.original_fullpath) %>" />
26
+ <meta property="og:title" content="<%= og_title %>" />
27
+ <meta property="og:site_name" content="<%= site_name %>">
28
+ <meta property="og:description" content="<%= og_description %>" />
29
+ <%= meta_property_og_image %>
30
+ <meta property="og:image" content="<%= og_image_default_url %>" />
31
+
32
+ <%= javascript_include_tag "modernizr" %>
33
+ <%= stylesheet_link_tag "application", media: "all" %>
34
+
35
+ <%= csrf_meta_tags %>
36
+ </head>
37
+ <body class="<%= body_class %>">
38
+
39
+ <!--[if lt IE 9]>
40
+ <p class="chromeframe" style="background-color: rgb(255,65,45); color: white; font-size: 12px; margin: 0; padding: 7px; text-align: center;">
41
+ You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/" style="color: black;">upgrade your browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true" style="color: black;">activate Google Chrome Frame</a> to improve your experience.</p>
42
+ <![endif]-->
43
+
44
+ <%= yield %>
45
+
46
+ <script type="text/javascript">
47
+ // Bridge between I18n YAML & JS
48
+ window.translations = { };
49
+ </script>
50
+
51
+ <%= javascript_include_tag "application" %>
52
+
53
+ <script type="text/javascript">
54
+ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
55
+ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
56
+ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
57
+ })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
58
+
59
+ ga('create', 'UA-XXXXXX-XX', 'auto');
60
+ ga('require', 'displayfeatures');
61
+ ga('send', 'pageview');
62
+ </script>
63
+ </body>
64
+ </html>
@@ -0,0 +1,64 @@
1
+ <!DOCTYPE html>
2
+ <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
3
+ <!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
4
+ <!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
5
+ <!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
6
+ <head>
7
+ <meta charset="utf-8">
8
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
9
+
10
+ <title><%= og_title %></title>
11
+
12
+ <meta name="viewport" content="width=device-width, initial-scale=1, minimal-ui" />
13
+
14
+ <meta name="description" content="<%= og_description %>" />
15
+ <meta name="distribution" content="global" />
16
+ <%= meta_name_robots %>
17
+ <meta name="revisit-after" content="31 days" />
18
+ <meta name="author" content="" />
19
+ <meta name="publisher" content="Mr. Henry" />
20
+ <meta name="copyright" content="" />
21
+
22
+ <link rel="shortcut icon" href="/assets/favicon.ico"/>
23
+ <link rel="canonical" href="<%= canonical_url(request.original_fullpath) %>" />
24
+
25
+ <meta property="og:url" content="<%= canonical_url(request.original_fullpath) %>" />
26
+ <meta property="og:title" content="<%= og_title %>" />
27
+ <meta property="og:site_name" content="<%= site_name %>">
28
+ <meta property="og:description" content="<%= og_description %>" />
29
+ <%= meta_property_og_image %>
30
+ <meta property="og:image" content="<%= og_image_default_url %>" />
31
+
32
+ <%= javascript_include_tag "modernizr" %>
33
+ <%= stylesheet_link_tag "application", media: "all" %>
34
+
35
+ <%= csrf_meta_tags %>
36
+ </head>
37
+ <body class="<%= body_class %>">
38
+
39
+ <!--[if lt IE 9]>
40
+ <p class="chromeframe" style="background-color: rgb(255,65,45); color: white; font-size: 12px; margin: 0; padding: 7px; text-align: center;">
41
+ You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/" style="color: black;">upgrade your browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true" style="color: black;">activate Google Chrome Frame</a> to improve your experience.</p>
42
+ <![endif]-->
43
+
44
+ <%= yield %>
45
+
46
+ <script type="text/javascript">
47
+ // Bridge between I18n YAML & JS
48
+ window.translations = { };
49
+ </script>
50
+
51
+ <%= javascript_include_tag "application" %>
52
+
53
+ <script type="text/javascript">
54
+ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
55
+ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
56
+ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
57
+ })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
58
+
59
+ ga('create', 'UA-XXXXXX-XX', 'auto');
60
+ ga('require', 'displayfeatures');
61
+ ga('send', 'pageview');
62
+ </script>
63
+ </body>
64
+ </html>
@@ -0,0 +1,16 @@
1
+ module ApplicationHelper
2
+
3
+ # When on .mrhenry.eu domain, we don't want a search crawler to index
4
+ #
5
+ # @return {String}
6
+ def meta_name_robots
7
+ if request.host.match /.*\.a\.mrhenry\.eu.*/
8
+ tag("meta", name: "robots", content: "noindex, nofollow")
9
+
10
+ else
11
+ tag("meta", name: "robots", content: "index, follow")
12
+
13
+ end
14
+ end
15
+
16
+ end
@@ -0,0 +1,60 @@
1
+ module HtmlHelper
2
+
3
+ # Returns class_name if x equals y
4
+ #
5
+ # @param {String} class_name
6
+ # @param {Mixed} x
7
+ # @param {Mixed} y
8
+ # @param {Boolean} exact
9
+ #
10
+ # @return {String}
11
+ def css_class(class_name, x, y = true, exact = false)
12
+ if exact
13
+ class_name if (x === y)
14
+
15
+ else
16
+ class_name if (x == y)
17
+
18
+ end
19
+ end
20
+
21
+
22
+ # Returns CSS body class
23
+ # By default it shows the current controller & action
24
+ # You can add items by using @body_class
25
+ #
26
+ # @return {String}
27
+ def body_class
28
+ body_class = [ params[:controller], params[:action] ]
29
+ body_class << @body_class if @body_class
30
+ body_class.join(" ")
31
+ end
32
+
33
+
34
+ # Return CSS background-image style
35
+ #
36
+ # @return {String}
37
+ def css_bg_img(img_url = nil)
38
+ "background-image: url('#{img_url}');"
39
+ end
40
+
41
+
42
+ # Includes inline SVG
43
+ #
44
+ # @param {String} path
45
+ #
46
+ # @return {String}
47
+ def inline_svg(path)
48
+ File.open("app/assets/images/#{path}", "rb") do |file|
49
+ raw file.read
50
+ end
51
+ end
52
+
53
+
54
+ # Render partial
55
+ #
56
+ def render_partial(partial_name, locals={}, &block)
57
+ render partial: partial_name, locals: locals.merge({ block: block })
58
+ end
59
+
60
+ end
@@ -0,0 +1,92 @@
1
+ module OpenGraphHelper
2
+
3
+ # Returns site name
4
+ #
5
+ # @return {String}
6
+ def site_name
7
+ "<%= Rails.application.class.name.split("::").first.titlecase.gsub("Client ", "") %>"
8
+ end
9
+
10
+
11
+ # Returns canonical url and following path for the given key in CANONICAL_URLS hash
12
+ #
13
+ # @params {String} path
14
+ #
15
+ # @return {String}
16
+ def canonical_url(path = '/', protocol = nil)
17
+ protocol ||= request.protocol
18
+
19
+ begin
20
+ "#{protocol}#{ENV["CANONICAL_DOMAIN"]}#{path}"
21
+
22
+ rescue
23
+ Rails.logger.error("canonical_url failed with following argument: #{path}")
24
+ "#{protocol}#{request.domain}#{path}"
25
+
26
+ end
27
+ end
28
+
29
+
30
+ # Returns meta description.
31
+ # Default lives in locale file. Add @og_description in your controller
32
+ # to override default.
33
+ #
34
+ # @return {String}
35
+ def og_description
36
+ @og_description.strip_tags rescue t("meta.description")
37
+ end
38
+
39
+
40
+ # Returns default OG image url based on current app name
41
+ #
42
+ # @return {String}
43
+ def og_image_default_url
44
+ "#{request.protocol}#{request.host_with_port}#{image_path("og-image.png")}"
45
+ end
46
+
47
+
48
+ # Returns meta og:image tags when @og_image(s) is given
49
+ #
50
+ # @return {String}
51
+ def meta_property_og_image
52
+ if @og_image
53
+ tag("meta", property: "og:image", content: "http:#{@og_image.url(:medium)}")
54
+ end
55
+
56
+ if @og_images
57
+ @og_images.each do |og_image|
58
+ tag("meta", property: "og:image", content: "http:#{og_image.url(:medium)}")
59
+ end
60
+ end
61
+ end
62
+
63
+
64
+ # Returns the page title, build upon the current page chain, separated by |
65
+ # To prefix, use @og_title in your controller.
66
+ #
67
+ # @param {Integer} offset How many page chain levels you want to skip
68
+ #
69
+ # @return {String}
70
+ def og_title(offset = 0)
71
+ page_title = []
72
+
73
+ if @og_title
74
+ if offset > 0
75
+ offset -= 1
76
+ else
77
+ page_title << @og_title
78
+ end
79
+ end
80
+
81
+ current_page_chain.reverse.each_with_index do |page, idx|
82
+ next if idx < offset
83
+
84
+ page_title << page.title unless page.type == "HomePage"
85
+ end
86
+
87
+ page_title << site_name
88
+
89
+ page_title.join(' | ')
90
+ end
91
+
92
+ end
@@ -0,0 +1,15 @@
1
+ module PagesHelper
2
+
3
+ # Returns page by class name & puts it in an instance variable
4
+ #
5
+ # @param {Class} page_class
6
+ #
7
+ # @return {ApplicationPage}
8
+ def get_page(page_class)
9
+ key = "@#{page_class.to_s.underscore.to_sym}"
10
+
11
+ page = instance_variable_get(key)
12
+ page ||= instance_variable_set(key, page_class.first)
13
+ end
14
+
15
+ end
@@ -0,0 +1,6 @@
1
+ # Sample localization file for English. Add more files in this directory for other locales.
2
+ # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
+
4
+ en:
5
+ meta:
6
+ description: ""
@@ -5,6 +5,12 @@ class AppBuilder < Rails::AppBuilder
5
5
  RUBY_VERSION = "2.1.0"
6
6
  LALALA_VERSION = "4.1.0.dev"
7
7
 
8
+ # You can test the generator locally by pointing to your local gems:
9
+ #
10
+ # gem 'lalala', path: "~/Github/mrhenry/lalala-ng"
11
+ # gem 'lalala-development', path: "~/Github/mrhenry/lalala-ng", groups: [:development]
12
+ # gem 'lalala-assets', path: "~/Github/mrhenry/lalala-ng", groups: [:development, :assets]
13
+ # gem 'lalala-test', path: "~/Github/mrhenry/lalala-ng", groups: [:test]
8
14
  def gemfile
9
15
  create_file 'Gemfile', <<-DOC
10
16
 
@@ -1,6 +1,6 @@
1
1
  module Lalala
2
2
  VERSION = "4.1.0"
3
- BUILD = "367"
3
+ BUILD = "375"
4
4
 
5
5
  if BUILD != ("{{BUILD_NUMBER" + "}}") # prevent sed replacement (see script/ci)
6
6
  BUILD_VERSION = "#{VERSION}.dev.#{BUILD}"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lalala
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.0.dev.367
4
+ version: 4.1.0.dev.375
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Menke
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2014-11-03 00:00:00.000000000 Z
16
+ date: 2014-11-05 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: activeadmin
@@ -1409,10 +1409,17 @@ files:
1409
1409
  - lib/generators/lalala/install/templates/active_admin.rb.erb
1410
1410
  - lib/generators/lalala/install/templates/admin_pages.rb
1411
1411
  - lib/generators/lalala/install/templates/admin_users.rb
1412
+ - lib/generators/lalala/install/templates/application.html.erb
1413
+ - lib/generators/lalala/install/templates/application.html.erb.orig
1412
1414
  - lib/generators/lalala/install/templates/application_mailer.html.erb
1413
1415
  - lib/generators/lalala/install/templates/dashboard.rb
1414
1416
  - lib/generators/lalala/install/templates/devise.rb.erb
1415
1417
  - lib/generators/lalala/install/templates/errors_controller.rb
1418
+ - lib/generators/lalala/install/templates/helpers/application_helper.rb
1419
+ - lib/generators/lalala/install/templates/helpers/html_helper.rb
1420
+ - lib/generators/lalala/install/templates/helpers/open_graph_helper.rb.erb
1421
+ - lib/generators/lalala/install/templates/helpers/pages_helper.rb
1422
+ - lib/generators/lalala/install/templates/locales/en.yml
1416
1423
  - lib/generators/lalala/install/templates/models/admin_user.rb
1417
1424
  - lib/generators/lalala/install/templates/models/application_page.rb
1418
1425
  - lib/generators/lalala/install/templates/pages_controller.rb