fl 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (137) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +44 -0
  3. data/Gemfile +5 -0
  4. data/Gemfile.lock +173 -0
  5. data/README.md +30 -0
  6. data/Rakefile +2 -0
  7. data/app/admin/options.rb +46 -0
  8. data/app/admin/pages.rb +55 -0
  9. data/app/admin/users.rb +34 -0
  10. data/app/assets/javascripts/active_admin.coffee.erb +20 -0
  11. data/app/assets/javascripts/application.coffee.erb +40 -0
  12. data/app/assets/javascripts/ckeditor/basepath.coffee.erb +21 -0
  13. data/app/assets/javascripts/ckeditor/config.coffee.erb +146 -0
  14. data/app/assets/javascripts/ckeditor/plugins/autogrow/plugin.js +232 -0
  15. data/app/assets/javascripts/ckeditor/plugins/autogrow/samples/autogrow.html +102 -0
  16. data/app/assets/javascripts/ckeditor/plugins/stylesheetparser/plugin.js +158 -0
  17. data/app/assets/javascripts/ckeditor/plugins/stylesheetparser/samples/assets/sample.css +70 -0
  18. data/app/assets/javascripts/ckeditor/plugins/stylesheetparser/samples/stylesheetparser.html +85 -0
  19. data/app/assets/javascripts/ckeditor/skins/minimalist/dialog.css +5 -0
  20. data/app/assets/javascripts/ckeditor/skins/minimalist/dialog_ie.css +5 -0
  21. data/app/assets/javascripts/ckeditor/skins/minimalist/dialog_ie7.css +5 -0
  22. data/app/assets/javascripts/ckeditor/skins/minimalist/dialog_ie8.css +5 -0
  23. data/app/assets/javascripts/ckeditor/skins/minimalist/dialog_iequirks.css +5 -0
  24. data/app/assets/javascripts/ckeditor/skins/minimalist/editor.css +5 -0
  25. data/app/assets/javascripts/ckeditor/skins/minimalist/editor_gecko.css +5 -0
  26. data/app/assets/javascripts/ckeditor/skins/minimalist/editor_ie.css +5 -0
  27. data/app/assets/javascripts/ckeditor/skins/minimalist/editor_ie7.css +5 -0
  28. data/app/assets/javascripts/ckeditor/skins/minimalist/editor_ie8.css +5 -0
  29. data/app/assets/javascripts/ckeditor/skins/minimalist/editor_iequirks.css +5 -0
  30. data/app/assets/javascripts/ckeditor/skins/minimalist/icons.png +0 -0
  31. data/app/assets/javascripts/ckeditor/skins/minimalist/icons_hidpi.png +0 -0
  32. data/app/assets/javascripts/ckeditor/skins/minimalist/images/arrow.png +0 -0
  33. data/app/assets/javascripts/ckeditor/skins/minimalist/images/close.png +0 -0
  34. data/app/assets/javascripts/ckeditor/skins/minimalist/images/hidpi/close.png +0 -0
  35. data/app/assets/javascripts/ckeditor/skins/minimalist/images/hidpi/lock-open.png +0 -0
  36. data/app/assets/javascripts/ckeditor/skins/minimalist/images/hidpi/lock.png +0 -0
  37. data/app/assets/javascripts/ckeditor/skins/minimalist/images/hidpi/refresh.png +0 -0
  38. data/app/assets/javascripts/ckeditor/skins/minimalist/images/lock-open.png +0 -0
  39. data/app/assets/javascripts/ckeditor/skins/minimalist/images/lock.png +0 -0
  40. data/app/assets/javascripts/ckeditor/skins/minimalist/images/refresh.png +0 -0
  41. data/app/assets/javascripts/ckeditor/skins/minimalist/readme.md +7 -0
  42. data/app/assets/javascripts/ckeditor/skins/minimalist/skin.js +10 -0
  43. data/app/assets/javascripts/ckeditor/skins/moonocolor/dialog.css +5 -0
  44. data/app/assets/javascripts/ckeditor/skins/moonocolor/dialog_ie.css +5 -0
  45. data/app/assets/javascripts/ckeditor/skins/moonocolor/dialog_ie7.css +5 -0
  46. data/app/assets/javascripts/ckeditor/skins/moonocolor/dialog_ie8.css +5 -0
  47. data/app/assets/javascripts/ckeditor/skins/moonocolor/dialog_iequirks.css +5 -0
  48. data/app/assets/javascripts/ckeditor/skins/moonocolor/editor.css +5 -0
  49. data/app/assets/javascripts/ckeditor/skins/moonocolor/editor_gecko.css +5 -0
  50. data/app/assets/javascripts/ckeditor/skins/moonocolor/editor_ie.css +5 -0
  51. data/app/assets/javascripts/ckeditor/skins/moonocolor/editor_ie7.css +5 -0
  52. data/app/assets/javascripts/ckeditor/skins/moonocolor/editor_ie8.css +5 -0
  53. data/app/assets/javascripts/ckeditor/skins/moonocolor/editor_iequirks.css +5 -0
  54. data/app/assets/javascripts/ckeditor/skins/moonocolor/icons.png +0 -0
  55. data/app/assets/javascripts/ckeditor/skins/moonocolor/icons_hidpi.png +0 -0
  56. data/app/assets/javascripts/ckeditor/skins/moonocolor/images/arrow.png +0 -0
  57. data/app/assets/javascripts/ckeditor/skins/moonocolor/images/close.png +0 -0
  58. data/app/assets/javascripts/ckeditor/skins/moonocolor/images/hidpi/close.png +0 -0
  59. data/app/assets/javascripts/ckeditor/skins/moonocolor/images/hidpi/lock-open.png +0 -0
  60. data/app/assets/javascripts/ckeditor/skins/moonocolor/images/hidpi/lock.png +0 -0
  61. data/app/assets/javascripts/ckeditor/skins/moonocolor/images/hidpi/refresh.png +0 -0
  62. data/app/assets/javascripts/ckeditor/skins/moonocolor/images/lock-open.png +0 -0
  63. data/app/assets/javascripts/ckeditor/skins/moonocolor/images/lock.png +0 -0
  64. data/app/assets/javascripts/ckeditor/skins/moonocolor/images/refresh.png +0 -0
  65. data/app/assets/javascripts/ckeditor/skins/moonocolor/images/spinner.gif +0 -0
  66. data/app/assets/javascripts/ckeditor/skins/moonocolor/readme.md +51 -0
  67. data/app/assets/javascripts/ckeditor/skins/moonocolor/skin.js +10 -0
  68. data/app/assets/javascripts/components/confirm.coffee +51 -0
  69. data/app/assets/javascripts/components/modals.coffee +29 -0
  70. data/app/assets/stylesheets/_defaults.yml +106 -0
  71. data/app/assets/stylesheets/_functions.sass.erb +75 -0
  72. data/app/assets/stylesheets/active_admin.sass +117 -0
  73. data/app/assets/stylesheets/application.sass.erb +46 -0
  74. data/app/assets/stylesheets/styles/reset.sass +139 -0
  75. data/app/assets/stylesheets/styles/structure.sass +69 -0
  76. data/app/assets/stylesheets/styles/ui/flash.sass +128 -0
  77. data/app/assets/stylesheets/styles/ui/fonts.sass +32 -0
  78. data/app/assets/stylesheets/styles/ui/modals.sass +61 -0
  79. data/app/assets/stylesheets/styles/ui/tooltips.sass +139 -0
  80. data/app/controllers/application_controller.rb +87 -0
  81. data/app/helpers/fl/application_helper.rb +53 -0
  82. data/app/helpers/fl/asset_helper.rb +50 -0
  83. data/app/helpers/fl/liquid_helper.rb +29 -0
  84. data/app/helpers/fl/meta_helper.rb +118 -0
  85. data/app/lib/active_record/concerns/base.rb +55 -0
  86. data/app/lib/active_record/concerns/seeds.rb +78 -0
  87. data/app/liquid/filters/meta_filter.rb +6 -0
  88. data/app/liquid/tags/google_analytics_tag.rb +32 -0
  89. data/app/liquid/tags/icon_tag.rb +37 -0
  90. data/app/liquid/tags/meta_tag.rb +120 -0
  91. data/app/mailers/application_mailer.rb +28 -0
  92. data/app/models/application_record.rb +3 -0
  93. data/app/models/asset.rb +95 -0
  94. data/app/models/association.rb +21 -0
  95. data/app/models/meta.rb +27 -0
  96. data/app/models/node.rb +59 -0
  97. data/app/models/profile.rb +49 -0
  98. data/app/models/user.rb +49 -0
  99. data/app/service/flash.rb +8 -0
  100. data/app/views/layouts/_admin.haml +6 -0
  101. data/app/views/layouts/_application.haml +17 -0
  102. data/app/views/layouts/base.haml +26 -0
  103. data/app/views/mailers/layouts/mailer.haml +8 -0
  104. data/app/views/mailers/layouts/mailer.text.erb +1 -0
  105. data/app/views/mailers/new_user.erb +4 -0
  106. data/bin/console +14 -0
  107. data/bin/setup +8 -0
  108. data/config/initializers/active_admin.rb +266 -0
  109. data/config/initializers/ckeditor.rb +63 -0
  110. data/config/initializers/devise.rb +279 -0
  111. data/config/initializers/friendly_id.rb +92 -0
  112. data/config/initializers/inflections.rb +20 -0
  113. data/config/initializers/liquid.rb +87 -0
  114. data/config/initializers/sass.rb +45 -0
  115. data/config/locales/devise.en.yml +62 -0
  116. data/config/locales/en.yml +13 -0
  117. data/config/puma.rb +59 -0
  118. data/config/routes.rb +56 -0
  119. data/db/migrate/20160616060637_create_nodes.rb +26 -0
  120. data/db/migrate/20160707080248_create_users.rb +52 -0
  121. data/db/migrate/20160707094704_create_slugs.rb +33 -0
  122. data/db/migrate/20160710095916_create_associations.rb +20 -0
  123. data/db/migrate/20160713061948_create_profiles.rb +27 -0
  124. data/db/migrate/20161115101221_create_assets.rb +25 -0
  125. data/db/migrate/20170725060408_create_active_admin_comments.rb +22 -0
  126. data/db/seeds.rb +81 -0
  127. data/fl.gemspec +73 -0
  128. data/lib/fl.rb +28 -0
  129. data/lib/fl/constants.rb +52 -0
  130. data/lib/fl/engine.rb +160 -0
  131. data/lib/fl/hash.rb +34 -0
  132. data/lib/generators/fl/sass_vars_generator.rb +16 -0
  133. data/lib/generators/fl/templates/sass.yml +56 -0
  134. data/lib/tasks/ckeditor.rake +37 -0
  135. data/lib/tasks/favicon.rake +37 -0
  136. data/readme/fl.jpg +0 -0
  137. metadata +416 -0
@@ -0,0 +1,87 @@
1
+ # => Loaded?
2
+ if Gem.loaded_specs.has_key? "liquid"
3
+
4
+
5
+ ###################################################
6
+ ###################################################
7
+
8
+ ## http://code.runnable.com/Up0qFjHu834vAABr/how-to-use-for-loops-in-liquid-templates-for-ruby-on-rails ##
9
+ class LiquidTemplateHandler
10
+ def self.call(template)
11
+ "sanitize LiquidTemplateHandler.new(self).render(#{template.source.inspect}, local_assigns)"
12
+ end
13
+
14
+ ###################################################
15
+ ###################################################
16
+
17
+ def initialize(view)
18
+ @view = view
19
+ end
20
+
21
+ def render(template, local_assigns = {})
22
+ @view.controller.headers["Content-Type"] ||= 'text/html; charset=utf-8'
23
+
24
+ assigns = @view.assigns
25
+
26
+ if @view.content_for?(:layout)
27
+ assigns["content_for_layout"] = @view.content_for(:layout)
28
+ end
29
+ assigns.merge!(local_assigns.stringify_keys)
30
+
31
+ controller = @view.controller
32
+ filters = if controller.respond_to?(:liquid_filters, true)
33
+ controller.send(:liquid_filters)
34
+ elsif controller.respond_to?(:master_helper_module)
35
+ [controller.master_helper_module]
36
+ else
37
+ [controller._helpers]
38
+ end
39
+
40
+
41
+ liquid = Liquid::Template.parse(template)
42
+ liquid.render(assigns, :filters => filters, :registers => {:action_view => @view, :controller => @view.controller})
43
+ end
44
+
45
+ def compilable?
46
+ false
47
+ end
48
+ end
49
+
50
+ #ActionView::Template.register_template_handler :liquid, LiquidTemplateHandler
51
+
52
+
53
+ ###############################
54
+ ###############################
55
+
56
+ # => Shortcodes
57
+ # => Should be extracted into own class / module
58
+ cache = ActiveSupport::Cache::MemoryStore.new
59
+ cache.write "shortcodes", { "CSS" => "TEST" }
60
+
61
+ ###############################
62
+ ###############################
63
+
64
+ ## Filters ##
65
+ ## these are meant to provide simple "transations" for code ##
66
+ ## Treat as shortcuts ##
67
+ ## {{ expression | call | call | call }}
68
+ #Liquid::Template.register_filter 'meta', MetaFilter
69
+
70
+ ## Tags ##
71
+ ## These are meant to be programmatic - if loops etc ##
72
+ ## Treat as small widget / app ##
73
+ ## {% title new title %}
74
+ ## {% icon database %}
75
+ %w(meta title csrf robots favicon js viewport stylesheet).each do |meta|
76
+ Liquid::Template.register_tag meta, Tags::MetaTag
77
+ end
78
+
79
+ Liquid::Template.register_tag 'icon', Tags::IconTag
80
+ Liquid::Template.register_tag 'ga', Tags::GoogleAnalyticsTag
81
+
82
+ ## Drops ##
83
+ ## Provide access to backend data (User / Node / etc) ##
84
+ ## Treat as object -- user.name etc ##
85
+ ## {{ user.name }} {{ options.analytics }}
86
+
87
+ end
@@ -0,0 +1,45 @@
1
+ ##############################
2
+ ##############################
3
+ #https://gist.github.com/unixmonkey/323198
4
+ #https://gist.github.com/evandrodutra/177372
5
+ ##############################
6
+ ##############################
7
+ #
8
+ # production:
9
+ # color: 'blue' #result: !color = blue
10
+ # host: 'http://example.com' #result: !host = http://example.com
11
+ # development:
12
+ # color: 'red'
13
+ # host: 'http://localhost:3000'
14
+ # test:
15
+ # color: 'gray' #result: !color = gray
16
+ # host: 'http://localhost:3000'
17
+ #
18
+ ##############################
19
+ ##############################
20
+ #
21
+ # Notes
22
+ # -> If you include several instances of the same variable, only the last one will be saved
23
+ # -> Whilst you can use the environment-based defintiions as above, you can also define variables on their own
24
+ # -> You can also include "groups" which allow you to create variables based on the grouped identity for them all
25
+ #
26
+ ##############################
27
+ ##############################
28
+
29
+ # Declarations
30
+ INPUT = File.join(Rails.root, "config", "sass.yml")
31
+ OUTPUT = File.join(Rails.root, "vendor", "assets", "stylesheets", "_variables.sass")
32
+
33
+ ##############################
34
+ ##############################
35
+
36
+ begin
37
+ File.open(OUTPUT, 'w+') do |file|
38
+ file.write FL::AssetHelper.sass INPUT
39
+ end
40
+ rescue => e
41
+ puts e
42
+ end
43
+
44
+ ##############################
45
+ ##############################
@@ -0,0 +1,62 @@
1
+ # Additional translations at https://github.com/plataformatec/devise/wiki/I18n
2
+
3
+ en:
4
+ devise:
5
+ confirmations:
6
+ confirmed: "Your email address has been successfully confirmed."
7
+ send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes."
8
+ send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes."
9
+ failure:
10
+ already_authenticated: "You are already signed in."
11
+ inactive: "Your account is not activated yet."
12
+ invalid: "Invalid %{authentication_keys} or password."
13
+ locked: "Your account is locked."
14
+ last_attempt: "You have one more attempt before your account is locked."
15
+ not_found_in_database: "Invalid %{authentication_keys} or password."
16
+ timeout: "Your session expired. Please sign in again to continue."
17
+ unauthenticated: "You need to sign in or sign up before continuing."
18
+ unconfirmed: "You have to confirm your email address before continuing."
19
+ mailer:
20
+ confirmation_instructions:
21
+ subject: "Confirmation instructions"
22
+ reset_password_instructions:
23
+ subject: "Reset password instructions"
24
+ unlock_instructions:
25
+ subject: "Unlock instructions"
26
+ password_change:
27
+ subject: "Password Changed"
28
+ omniauth_callbacks:
29
+ failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
30
+ success: "Successfully authenticated from %{kind} account."
31
+ passwords:
32
+ no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
33
+ send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
34
+ send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
35
+ updated: "Your password has been changed successfully. You are now signed in."
36
+ updated_not_active: "Your password has been changed successfully."
37
+ registrations:
38
+ destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon."
39
+ signed_up: "Welcome! You have signed up successfully."
40
+ signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
41
+ signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
42
+ signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account."
43
+ update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirm link to confirm your new email address."
44
+ updated: "Your account has been updated successfully."
45
+ sessions:
46
+ signed_in: "Signed in successfully."
47
+ signed_out: "Signed out successfully."
48
+ already_signed_out: "Signed out successfully."
49
+ unlocks:
50
+ send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes."
51
+ send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes."
52
+ unlocked: "Your account has been unlocked successfully. Please sign in to continue."
53
+ errors:
54
+ messages:
55
+ already_confirmed: "was already confirmed, please try signing in"
56
+ confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
57
+ expired: "has expired, please request a new one"
58
+ not_found: "not found"
59
+ not_locked: "was not locked"
60
+ not_saved:
61
+ one: "1 error prohibited this %{resource} from being saved:"
62
+ other: "%{count} errors prohibited this %{resource} from being saved:"
@@ -0,0 +1,13 @@
1
+ en:
2
+ exception_handler:
3
+ not_found: "Node Not Found"
4
+ activerecord:
5
+ models:
6
+ meta/option:
7
+ one: "Option"
8
+ other: "Options"
9
+ attributes:
10
+ node:
11
+ slug: "URL"
12
+ ref: "Title"
13
+ val: "Content"
data/config/puma.rb ADDED
@@ -0,0 +1,59 @@
1
+ ########################################
2
+ ########################################
3
+ ## _____ ##
4
+ ## | ___ \ ##
5
+ ## | |_/ / _ _ __ ___ __ _ ##
6
+ ## | __/ | | | '_ ` _ \ / _` | ##
7
+ ## | | | |_| | | | | | | (_| | ##
8
+ ## \_| \__,_|_| |_| |_|\__,_| ##
9
+ ## ##
10
+ ########################################
11
+ ########################################
12
+
13
+ # Puma can serve each request in a thread from an internal thread pool.
14
+ # The `threads` method setting takes two numbers a minimum and maximum.
15
+ # Any libraries that use thread pools should be configured to match
16
+ # the maximum value specified for Puma. Default is set to 5 threads for minimum
17
+ # and maximum, this matches the default thread size of Active Record.
18
+ #
19
+ threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i
20
+ threads threads_count, threads_count
21
+
22
+ # Specifies the `port` that Puma will listen on to receive requests, default is 3000.
23
+ # => https://github.com/puma/puma/issues/1200
24
+ port ENV.fetch("PORT") { 4200 }
25
+
26
+ # Specifies the `environment` that Puma will run in.
27
+ #
28
+ environment ENV.fetch("RAILS_ENV") { "development" }
29
+
30
+ # Specifies the number of `workers` to boot in clustered mode.
31
+ # Workers are forked webserver processes. If using threads and workers together
32
+ # the concurrency of the application would be max `threads` * `workers`.
33
+ # Workers do not work on JRuby or Windows (both of which do not support
34
+ # processes).
35
+ #
36
+ # workers ENV.fetch("WEB_CONCURRENCY") { 2 }
37
+
38
+ # Use the `preload_app!` method when specifying a `workers` number.
39
+ # This directive tells Puma to first boot the application and load code
40
+ # before forking the application. This takes advantage of Copy On Write
41
+ # process behavior so workers use less memory. If you use this option
42
+ # you need to make sure to reconnect any threads in the `on_worker_boot`
43
+ # block.
44
+ #
45
+ # preload_app!
46
+
47
+ # The code in the `on_worker_boot` will be called if you are using
48
+ # clustered mode by specifying a number of `workers`. After each worker
49
+ # process is booted this block will be run, if you are using `preload_app!`
50
+ # option you will want to use this block to reconnect to any threads
51
+ # or connections that may have been created at application boot, Ruby
52
+ # cannot share connections between processes.
53
+ #
54
+ # on_worker_boot do
55
+ # ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
56
+ # end
57
+
58
+ # Allow puma to be restarted by `rails restart` command.
59
+ plugin :tmp_restart
data/config/routes.rb ADDED
@@ -0,0 +1,56 @@
1
+ ########################################
2
+ ########################################
3
+ ## _____ _ ##
4
+ ## | ___ \ | | ##
5
+ ## | |_/ /___ _ _| |_ ___ ___ ##
6
+ ## | // _ \| | | | __/ _ \/ __| ##
7
+ ## | |\ \ (_) | |_| | || __/\__ \ ##
8
+ ## \_| \_\___/ \__,_|\__\___||___/ ##
9
+ ## ##
10
+ ########################################
11
+ ########################################
12
+
13
+ ## Good resource
14
+ ## https://gist.github.com/maxivak/5d428ade54828836e6b6#merge-engine-and-app-routes
15
+
16
+ ########################################
17
+ ########################################
18
+
19
+ ## Routes ##
20
+ Rails.application.routes.draw do
21
+
22
+ ########################################
23
+ ########################################
24
+
25
+ # => CKEditor
26
+ mount Ckeditor::Engine => '/ckeditor' if Gem.loaded_specs.has_key? "ckeditor"
27
+
28
+ # => Admin
29
+ devise_for :users, ActiveAdmin::Devise.config
30
+ ActiveAdmin.routes(self)
31
+
32
+ ########################################
33
+ ########################################
34
+
35
+ # Index
36
+ # => Shows index of app
37
+ root "application#show"
38
+
39
+ ########################################
40
+ ########################################
41
+
42
+ # Robots.txt
43
+ # => https://blog.ragnarson.com/2013/11/15/hide-your-staging-environment-from-google.html
44
+ get "robots.txt" => "application#robots", as: :robots
45
+
46
+ ########################################
47
+ ########################################
48
+
49
+ # => Everything else
50
+ # => Nodes shown through system
51
+ resources :application, only: :show, path: "" # => url.com/:id
52
+
53
+ ########################################
54
+ ########################################
55
+
56
+ end
@@ -0,0 +1,26 @@
1
+ class CreateNodes < ActiveRecord::Migration::Current
2
+ include ActiveRecord::Concerns::Base
3
+
4
+ #########################################
5
+ #########################################
6
+
7
+ # => Up
8
+ # => enable_extension for Ruby 2.4.0 on Heroku
9
+ def up
10
+ enable_extension 'uuid-ossp' if adapter == "postgresql" # => http://theworkaround.com/2015/06/12/using-uuids-in-rails.html#postgresql
11
+
12
+ # => Table
13
+ create_table table, uuid do |t| # => users stored through "associations"
14
+ t.references :user
15
+ t.string :type
16
+ t.string :slug
17
+ t.string :ref
18
+ t.text :val, length: 4294967295
19
+ t.timestamps
20
+ end
21
+ end
22
+
23
+ #########################################
24
+ #########################################
25
+
26
+ end
@@ -0,0 +1,52 @@
1
+ class CreateUsers < ActiveRecord::Migration::Current
2
+ include ActiveRecord::Concerns::Base
3
+
4
+ #########################################
5
+ #########################################
6
+
7
+ # Up
8
+ def up
9
+ create_table table do |t|
10
+
11
+ ## Database authenticatable
12
+ t.string :email, null: false, default: ""
13
+ t.string :encrypted_password, null: false, default: ""
14
+
15
+ ## Recoverable
16
+ t.string :reset_password_token
17
+ t.datetime :reset_password_sent_at
18
+
19
+ ## Rememberable
20
+ t.datetime :remember_created_at
21
+
22
+ ## Trackable
23
+ t.integer :sign_in_count, default: 0, null: false
24
+ t.datetime :current_sign_in_at
25
+ t.datetime :last_sign_in_at
26
+ t.string :current_sign_in_ip
27
+ t.string :last_sign_in_ip
28
+
29
+ ## Confirmable
30
+ #t.string :confirmation_token
31
+ #t.datetime :confirmed_at
32
+ #t.datetime :confirmation_sent_at
33
+ #t.string :unconfirmed_email # Only if using reconfirmable
34
+
35
+ ## Lockable
36
+ #t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
37
+ #t.string :unlock_token # Only if unlock strategy is :email or :both
38
+ #t.datetime :locked_at
39
+
40
+ t.timestamps null: false
41
+ end
42
+
43
+ add_index table, :email, unique: true
44
+ add_index table, :reset_password_token, unique: true
45
+ # add_index table, :confirmation_token, unique: true
46
+ # add_index table, :unlock_token, unique: true
47
+ end
48
+
49
+ #########################################
50
+ #########################################
51
+
52
+ end
@@ -0,0 +1,33 @@
1
+ class CreateSlugs < ActiveRecord::Migration::Current
2
+ include ActiveRecord::Concerns::Base
3
+
4
+ #########################################
5
+ #########################################
6
+
7
+ # Table
8
+ def table
9
+ FriendlyId::Slug.table_name
10
+ end
11
+
12
+ #########################################
13
+ #########################################
14
+
15
+ # Up
16
+ def up
17
+ create_table table do |t|
18
+ t.string :slug, :null => false
19
+ t.integer :sluggable_id, :null => false
20
+ t.string :sluggable_type, :limit => 50
21
+ t.string :scope
22
+ t.datetime :created_at
23
+ end
24
+ add_index table, :sluggable_id
25
+ add_index table, [:slug, :sluggable_type]
26
+ add_index table, [:slug, :sluggable_type, :scope], unique: true
27
+ add_index table, :sluggable_type
28
+ end
29
+
30
+ #########################################
31
+ #########################################
32
+
33
+ end