raddar 0.0.1.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +3 -0
  4. data/Rakefile +27 -0
  5. data/app/assets/images/raddar/fallback/avatar/medium.png +0 -0
  6. data/app/assets/images/raddar/fallback/avatar/thumb.png +0 -0
  7. data/app/assets/javascripts/raddar/admin/dashboard.js.coffee +3 -0
  8. data/app/assets/javascripts/raddar/application.js +16 -0
  9. data/app/assets/javascripts/raddar/followerships.js.coffee +3 -0
  10. data/app/assets/javascripts/raddar/home.js.coffee +3 -0
  11. data/app/assets/javascripts/raddar/notifications.js.coffee +16 -0
  12. data/app/assets/javascripts/raddar/users.js.coffee +3 -0
  13. data/app/assets/javascripts/raddar/users/privacies.js.coffee +3 -0
  14. data/app/assets/stylesheets/raddar/admin/dashboard.css.scss +3 -0
  15. data/app/assets/stylesheets/raddar/application.css +14 -0
  16. data/app/assets/stylesheets/raddar/followerships.css.scss +3 -0
  17. data/app/assets/stylesheets/raddar/home.css.scss +3 -0
  18. data/app/assets/stylesheets/raddar/notifications.css.scss +6 -0
  19. data/app/assets/stylesheets/raddar/users.css.scss +3 -0
  20. data/app/assets/stylesheets/raddar/users/privacies.css.scss +3 -0
  21. data/app/controllers/raddar/admin/dashboard_controller.rb +11 -0
  22. data/app/controllers/raddar/admin/users_controller.rb +34 -0
  23. data/app/controllers/raddar/application_controller.rb +17 -0
  24. data/app/controllers/raddar/followerships_controller.rb +60 -0
  25. data/app/controllers/raddar/home_controller.rb +8 -0
  26. data/app/controllers/raddar/notifications_controller.rb +31 -0
  27. data/app/controllers/raddar/users/email_preferences_controller.rb +24 -0
  28. data/app/controllers/raddar/users/external_accounts_controller.rb +18 -0
  29. data/app/controllers/raddar/users/omniauth_callbacks_controller.rb +30 -0
  30. data/app/controllers/raddar/users/passwords_controller.rb +22 -0
  31. data/app/controllers/raddar/users/privacies_controller.rb +25 -0
  32. data/app/controllers/raddar/users/registrations_controller.rb +51 -0
  33. data/app/controllers/raddar/users/sessions_controller.rb +11 -0
  34. data/app/controllers/raddar/users_controller.rb +8 -0
  35. data/app/helpers/raddar/admin/dashboard_helper.rb +4 -0
  36. data/app/helpers/raddar/application_helper.rb +4 -0
  37. data/app/helpers/raddar/notifications_helper.rb +19 -0
  38. data/app/helpers/raddar/users/privacies_helper.rb +4 -0
  39. data/app/mailers/raddar/notification_mailer.rb +16 -0
  40. data/app/models/raddar/external_account.rb +12 -0
  41. data/app/models/raddar/followership.rb +20 -0
  42. data/app/models/raddar/followership_completion.rb +37 -0
  43. data/app/models/raddar/notification.rb +10 -0
  44. data/app/models/raddar/omniauth_completion.rb +83 -0
  45. data/app/models/raddar/role.rb +7 -0
  46. data/app/models/raddar/user.rb +70 -0
  47. data/app/policies/raddar/admin/dashboard_policy.rb +7 -0
  48. data/app/policies/raddar/admin/user_policy.rb +15 -0
  49. data/app/policies/raddar/application_policy.rb +42 -0
  50. data/app/policies/raddar/followership_policy.rb +25 -0
  51. data/app/policies/raddar/notification_policy.rb +21 -0
  52. data/app/policies/raddar/user_policy.rb +17 -0
  53. data/app/uploaders/raddar/avatar_uploader.rb +56 -0
  54. data/app/views/layouts/raddar/_alerts.html.erb +3 -0
  55. data/app/views/layouts/raddar/_navbar.html.erb +22 -0
  56. data/app/views/layouts/raddar/_notifications.html.erb +20 -0
  57. data/app/views/layouts/raddar/_user_menu.html.erb +21 -0
  58. data/app/views/layouts/raddar/application.html.erb +21 -0
  59. data/app/views/layouts/raddar/notification_mailer.html.erb +12 -0
  60. data/app/views/raddar/admin/dashboard/index.html.erb +6 -0
  61. data/app/views/raddar/admin/users/index.html.erb +11 -0
  62. data/app/views/raddar/admin/users/show.html.erb +12 -0
  63. data/app/views/raddar/followerships/followers.html.erb +9 -0
  64. data/app/views/raddar/followerships/following.html.erb +9 -0
  65. data/app/views/raddar/home/index.html.erb +1 -0
  66. data/app/views/raddar/notification_mailer/new_follower.html.erb +11 -0
  67. data/app/views/raddar/notifications/index.html.erb +12 -0
  68. data/app/views/raddar/notifications/index.json.jbuilder +4 -0
  69. data/app/views/raddar/users/confirmations/new.html.erb +16 -0
  70. data/app/views/raddar/users/email_preferences/edit.html.erb +11 -0
  71. data/app/views/raddar/users/external_accounts/index.html.erb +14 -0
  72. data/app/views/raddar/users/mailer/confirmation_instructions.html.erb +5 -0
  73. data/app/views/raddar/users/mailer/reset_password_instructions.html.erb +8 -0
  74. data/app/views/raddar/users/mailer/unlock_instructions.html.erb +7 -0
  75. data/app/views/raddar/users/passwords/change.html.erb +13 -0
  76. data/app/views/raddar/users/passwords/edit.html.erb +19 -0
  77. data/app/views/raddar/users/passwords/new.html.erb +15 -0
  78. data/app/views/raddar/users/privacies/edit.html.erb +12 -0
  79. data/app/views/raddar/users/registrations/destroy.html.erb +13 -0
  80. data/app/views/raddar/users/registrations/edit.html.erb +30 -0
  81. data/app/views/raddar/users/registrations/new.html.erb +16 -0
  82. data/app/views/raddar/users/sessions/new.html.erb +13 -0
  83. data/app/views/raddar/users/shared/_links.erb +25 -0
  84. data/app/views/raddar/users/show.html.erb +52 -0
  85. data/app/views/raddar/users/unlocks/new.html.erb +16 -0
  86. data/config/cucumber.yml +8 -0
  87. data/config/initializers/carrierwave.rb +10 -0
  88. data/config/initializers/devise.rb +262 -0
  89. data/config/initializers/kaminari_config.rb +10 -0
  90. data/config/initializers/simple_form.rb +142 -0
  91. data/config/initializers/simple_form_bootstrap.rb +17 -0
  92. data/config/locales/devise.en.yml +59 -0
  93. data/config/locales/en.yml +49 -0
  94. data/config/locales/flash.en.yml +20 -0
  95. data/config/locales/mailers.en.yml +5 -0
  96. data/config/locales/simple_form.en.yml +35 -0
  97. data/config/locales/views.en.yml +36 -0
  98. data/config/routes.rb +43 -0
  99. data/db/migrate/20130824222728_devise_create_raddar_users.rb +66 -0
  100. data/db/migrate/20131013222926_create_raddar_followerships.rb +14 -0
  101. data/db/migrate/20131020174318_create_raddar_roles.rb +11 -0
  102. data/db/migrate/20131020175354_create_join_table_raddar_role_user.rb +8 -0
  103. data/db/migrate/20131021134623_create_raddar_notifications.rb +13 -0
  104. data/db/migrate/20131026133924_create_raddar_external_accounts.rb +23 -0
  105. data/lib/raddar.rb +15 -0
  106. data/lib/raddar/engine.rb +5 -0
  107. data/lib/raddar/hstore_serializer.rb +22 -0
  108. data/lib/raddar/version.rb +3 -0
  109. data/lib/tasks/cucumber.rake +65 -0
  110. data/lib/tasks/raddar_tasks.rake +4 -0
  111. metadata +390 -0
@@ -0,0 +1,10 @@
1
+ Kaminari.configure do |config|
2
+ config.default_per_page = 10
3
+ # config.max_per_page = nil
4
+ # config.window = 4
5
+ # config.outer_window = 0
6
+ # config.left = 0
7
+ # config.right = 0
8
+ # config.page_method_name = :page
9
+ # config.param_name = :page
10
+ end
@@ -0,0 +1,142 @@
1
+ # Use this setup block to configure all options available in SimpleForm.
2
+ SimpleForm.setup do |config|
3
+ # Wrappers are used by the form builder to generate a
4
+ # complete input. You can remove any component from the
5
+ # wrapper, change the order or even add your own to the
6
+ # stack. The options given below are used to wrap the
7
+ # whole input.
8
+ config.wrappers :default, class: :input,
9
+ hint_class: :field_with_hint, error_class: :field_with_errors do |b|
10
+ ## Extensions enabled by default
11
+ # Any of these extensions can be disabled for a
12
+ # given input by passing: `f.input EXTENSION_NAME => false`.
13
+ # You can make any of these extensions optional by
14
+ # renaming `b.use` to `b.optional`.
15
+
16
+ # Determines whether to use HTML5 (:email, :url, ...)
17
+ # and required attributes
18
+ b.use :html5
19
+
20
+ # Calculates placeholders automatically from I18n
21
+ # You can also pass a string as f.input placeholder: "Placeholder"
22
+ b.use :placeholder
23
+
24
+ ## Optional extensions
25
+ # They are disabled unless you pass `f.input EXTENSION_NAME => :lookup`
26
+ # to the input. If so, they will retrieve the values from the model
27
+ # if any exists. If you want to enable the lookup for any of those
28
+ # extensions by default, you can change `b.optional` to `b.use`.
29
+
30
+ # Calculates maxlength from length validations for string inputs
31
+ b.optional :maxlength
32
+
33
+ # Calculates pattern from format validations for string inputs
34
+ b.optional :pattern
35
+
36
+ # Calculates min and max from length validations for numeric inputs
37
+ b.optional :min_max
38
+
39
+ # Calculates readonly automatically from readonly attributes
40
+ b.optional :readonly
41
+
42
+ ## Inputs
43
+ b.use :label_input
44
+ b.use :hint, wrap_with: { tag: :span, class: :hint }
45
+ b.use :error, wrap_with: { tag: :span, class: :error }
46
+ end
47
+
48
+ # The default wrapper to be used by the FormBuilder.
49
+ config.default_wrapper = :default
50
+
51
+ # Define the way to render check boxes / radio buttons with labels.
52
+ # Defaults to :nested for bootstrap config.
53
+ # inline: input + label
54
+ # nested: label > input
55
+ config.boolean_style = :nested
56
+
57
+ # Default class for buttons
58
+ config.button_class = 'btn'
59
+
60
+ # Method used to tidy up errors. Specify any Rails Array method.
61
+ # :first lists the first message for each field.
62
+ # Use :to_sentence to list all errors for each field.
63
+ # config.error_method = :first
64
+
65
+ # Default tag used for error notification helper.
66
+ config.error_notification_tag = :div
67
+
68
+ # CSS class to add for error notification helper.
69
+ config.error_notification_class = 'alert alert-error'
70
+
71
+ # ID to add for error notification helper.
72
+ # config.error_notification_id = nil
73
+
74
+ # Series of attempts to detect a default label method for collection.
75
+ # config.collection_label_methods = [ :to_label, :name, :title, :to_s ]
76
+
77
+ # Series of attempts to detect a default value method for collection.
78
+ # config.collection_value_methods = [ :id, :to_s ]
79
+
80
+ # You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none.
81
+ # config.collection_wrapper_tag = nil
82
+
83
+ # You can define the class to use on all collection wrappers. Defaulting to none.
84
+ # config.collection_wrapper_class = nil
85
+
86
+ # You can wrap each item in a collection of radio/check boxes with a tag,
87
+ # defaulting to :span. Please note that when using :boolean_style = :nested,
88
+ # SimpleForm will force this option to be a label.
89
+ # config.item_wrapper_tag = :span
90
+
91
+ # You can define a class to use in all item wrappers. Defaulting to none.
92
+ # config.item_wrapper_class = nil
93
+
94
+ # How the label text should be generated altogether with the required text.
95
+ # config.label_text = lambda { |label, required| "#{required} #{label}" }
96
+
97
+ # You can define the class to use on all labels. Default is nil.
98
+ config.label_class = 'control-label'
99
+
100
+ # You can define the class to use on all forms. Default is simple_form.
101
+ # config.form_class = :simple_form
102
+
103
+ # You can define which elements should obtain additional classes
104
+ # config.generate_additional_classes_for = [:wrapper, :label, :input]
105
+
106
+ # Whether attributes are required by default (or not). Default is true.
107
+ # config.required_by_default = true
108
+
109
+ # Tell browsers whether to use the native HTML5 validations (novalidate form option).
110
+ # These validations are enabled in SimpleForm's internal config but disabled by default
111
+ # in this configuration, which is recommended due to some quirks from different browsers.
112
+ # To stop SimpleForm from generating the novalidate option, enabling the HTML5 validations,
113
+ # change this configuration to true.
114
+ config.browser_validations = false
115
+
116
+ # Collection of methods to detect if a file type was given.
117
+ # config.file_methods = [ :mounted_as, :file?, :public_filename ]
118
+
119
+ # Custom mappings for input types. This should be a hash containing a regexp
120
+ # to match as key, and the input type that will be used when the field name
121
+ # matches the regexp as value.
122
+ # config.input_mappings = { /count/ => :integer }
123
+
124
+ # Custom wrappers for input types. This should be a hash containing an input
125
+ # type as key and the wrapper that will be used for all inputs with specified type.
126
+ # config.wrapper_mappings = { string: :prepend }
127
+
128
+ # Default priority for time_zone inputs.
129
+ # config.time_zone_priority = nil
130
+
131
+ # Default priority for country inputs.
132
+ # config.country_priority = nil
133
+
134
+ # When false, do not use translations for labels.
135
+ # config.translate_labels = true
136
+
137
+ # Automatically discover new inputs in Rails' autoload path.
138
+ # config.inputs_discovery = true
139
+
140
+ # Cache SimpleForm inputs discovery
141
+ # config.cache_discovery = !Rails.env.development?
142
+ end
@@ -0,0 +1,17 @@
1
+ # Use this setup block to configure all options available in SimpleForm.
2
+ SimpleForm.setup do |config|
3
+ config.wrappers :bootstrap, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
4
+ b.use :html5
5
+ b.use :placeholder
6
+ b.use :label, class: 'control-label'
7
+ b.use :input, class: 'form-control'
8
+ b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
9
+ b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
10
+ end
11
+
12
+ # Wrappers for forms and inputs using the Twitter Bootstrap toolkit.
13
+ # Check the Bootstrap docs (http://twitter.github.com/bootstrap)
14
+ # to learn about the different styles for forms and inputs,
15
+ # buttons and other elements.
16
+ config.default_wrapper = :bootstrap
17
+ end
@@ -0,0 +1,59 @@
1
+ # Additional translations at https://github.com/plataformatec/devise/wiki/I18n
2
+
3
+ en:
4
+ devise:
5
+ confirmations:
6
+ confirmed: "Your account was successfully confirmed. You are now signed in."
7
+ send_instructions: "You will receive an email with instructions about how to confirm your account in a few minutes."
8
+ send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions about how to confirm your account 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 name/email or password."
13
+ invalid_token: "Invalid authentication token."
14
+ locked: "Your account is locked."
15
+ not_found_in_database: "Invalid name/email 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 account 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
+ omniauth_callbacks:
27
+ failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
28
+ success: "Successfully authenticated from %{kind} account."
29
+ passwords:
30
+ 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."
31
+ send_instructions: "You will receive an email with instructions about how to reset your password in a few minutes."
32
+ 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."
33
+ updated: "Your password was changed successfully. You are now signed in."
34
+ updated_not_active: "Your password was changed successfully."
35
+ registrations:
36
+ destroyed: "Bye! Your account was successfully cancelled. We hope to see you again soon."
37
+ signed_up: "Welcome! You have signed up successfully."
38
+ signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
39
+ signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
40
+ signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please open the link to activate your account."
41
+ update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and click on the confirm link to finalize confirming your new email address."
42
+ updated: "You updated your account successfully."
43
+ sessions:
44
+ signed_in: "Signed in successfully."
45
+ signed_out: "Signed out successfully."
46
+ unlocks:
47
+ send_instructions: "You will receive an email with instructions about how to unlock your account in a few minutes."
48
+ send_paranoid_instructions: "If your account exists, you will receive an email with instructions about how to unlock it in a few minutes."
49
+ unlocked: "Your account has been unlocked successfully. Please sign in to continue."
50
+ errors:
51
+ messages:
52
+ already_confirmed: "was already confirmed, please try signing in"
53
+ confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
54
+ expired: "has expired, please request a new one"
55
+ not_found: "not found"
56
+ not_locked: "was not locked"
57
+ not_saved:
58
+ one: "1 error prohibited this %{resource} from being saved:"
59
+ other: "%{count} errors prohibited this %{resource} from being saved:"
@@ -0,0 +1,49 @@
1
+ # Files in the config/locales directory are used for internationalization
2
+ # and are automatically loaded by Rails. If you want to use locales other
3
+ # than English, add the necessary files in this directory.
4
+ #
5
+ # To use the locales, use `I18n.t`:
6
+ #
7
+ # I18n.t 'hello'
8
+ #
9
+ # In views, this is aliased to just `t`:
10
+ #
11
+ # <%= t('hello') %>
12
+ #
13
+ # To use a different locale, set it with `I18n.locale`:
14
+ #
15
+ # I18n.locale = :es
16
+ #
17
+ # This would use the information in config/locales/es.yml.
18
+ #
19
+ # To learn more, please read the Rails Internationalization guide
20
+ # available at http://guides.rubyonrails.org/i18n.html.
21
+
22
+ en:
23
+ user:
24
+ show: 'Profile'
25
+ registration:
26
+ edit: 'Edit account'
27
+ session:
28
+ new: 'Sign in'
29
+ destroy: 'Sign out'
30
+ gender_options:
31
+ female: 'Female'
32
+ male: 'Male'
33
+ followership:
34
+ follow: 'Follow'
35
+ unfollow: 'Unfollow'
36
+ followers: 'Followers'
37
+ following: 'Following'
38
+ role:
39
+ names:
40
+ admin: 'Admin'
41
+ admin:
42
+ dashboard: 'Admin dashboard'
43
+ users: 'Users'
44
+ save: 'Save'
45
+ notifications:
46
+ tokens:
47
+ new_follower: '%{notifiable} started following you.'
48
+ see_all: 'See all'
49
+
@@ -0,0 +1,20 @@
1
+ en:
2
+ flash:
3
+ users:
4
+ passwords:
5
+ do_change: 'Password changed!'
6
+ privacies:
7
+ update: 'Your settings were updated.'
8
+ sessions:
9
+ blocked: 'Your account is blocked. Please contact the admin.'
10
+ email_preferences:
11
+ update: 'Your email preferences were saved.'
12
+ external_accounts:
13
+ destroy: 'You are no longer connected via %{provider}.'
14
+ followerships:
15
+ create: 'Now you are following %{followable}.'
16
+ destroy: 'You stopped following %{followable}.'
17
+ unauthorized: 'You cannot access this.'
18
+ admin:
19
+ users:
20
+ update: 'The settings for %{user} were successfully updated.'
@@ -0,0 +1,5 @@
1
+ en:
2
+ mailers:
3
+ notification:
4
+ new_follower:
5
+ subject: '%{follower} is now following you!'
@@ -0,0 +1,35 @@
1
+ en:
2
+ simple_form:
3
+ "yes": 'Yes'
4
+ "no": 'No'
5
+ required:
6
+ text: 'required'
7
+ mark: '*'
8
+ # You can uncomment the line below if you need to overwrite the whole required html.
9
+ # When using html, text and mark won't be used.
10
+ # html: '<abbr title="required">*</abbr>'
11
+ error_notification:
12
+ default_message: "Please review the problems below:"
13
+ # Labels and hints examples
14
+ labels:
15
+ # defaults:
16
+ # password: 'Password'
17
+ user:
18
+ login: 'Name or e-mail'
19
+ options:
20
+ user:
21
+ gender:
22
+ female: 'Female'
23
+ male: 'Male'
24
+ state:
25
+ active: 'Active'
26
+ blocked: 'Blocked'
27
+ # new:
28
+ # email: 'E-mail to sign in.'
29
+ # edit:
30
+ # email: 'E-mail.'
31
+ # hints:
32
+ # defaults:
33
+ # username: 'User name to sign in.'
34
+ # password: 'No special characters, please.'
35
+
@@ -0,0 +1,36 @@
1
+ en:
2
+ raddar:
3
+ users:
4
+ passwords:
5
+ change:
6
+ title: 'Change password'
7
+ submit: 'Change'
8
+ password_label: 'New password'
9
+ show:
10
+ unconfirmed_email: 'Currently waiting confirmation for: %{email}'
11
+ privacies:
12
+ edit:
13
+ title: 'Privacy settings'
14
+ options:
15
+ only_me: 'Only me'
16
+ public: 'Public'
17
+ submit: 'Save'
18
+ email_preferences:
19
+ edit:
20
+ title: 'Email preferences'
21
+ keys:
22
+ new_follower: 'New followers'
23
+ submit: 'Save'
24
+ external_accounts:
25
+ index:
26
+ title: 'External accounts'
27
+ connect: 'Connect %{provider} account'
28
+ destroy: 'Disconnect %{provider}'
29
+ registrations:
30
+ destroy:
31
+ title: 'Destroy account'
32
+ alert: 'By destroying your account, your profile and all data created by you will be completely erased. If you still want to destroy your account, please fill your password below:'
33
+ submit: 'I understand the consequences. Destroy my account.'
34
+ notifications:
35
+ index:
36
+ title: 'All notifications'
data/config/routes.rb ADDED
@@ -0,0 +1,43 @@
1
+ Raddar::Engine.routes.draw do
2
+ resources :notifications, only: [:index, :show] do
3
+ patch 'read_all', on: :collection
4
+ end
5
+
6
+ devise_for :users,
7
+ controllers: {
8
+ registrations: 'raddar/users/registrations',
9
+ sessions: 'raddar/users/sessions',
10
+ passwords: 'raddar/users/passwords',
11
+ omniauth_callbacks: 'raddar/users/omniauth_callbacks'
12
+ },
13
+ module: :devise,
14
+ class_name: 'Raddar::User'
15
+
16
+ as :user do
17
+ get '/users/password/change' => 'users/passwords#change', as: :change_user_password
18
+ patch '/users/password/change' => 'users/passwords#do_change', as: :do_change_user_password
19
+ get '/users/registrations/destroy' => 'users/registrations#destroy', as: :destroy_user_registration
20
+ end
21
+ # The priority is based upon order of creation: first created -> highest priority.
22
+ # See how all your routes lay out with "rake routes".
23
+
24
+ # You can have the root of your site routed with "root"
25
+ root 'home#index'
26
+
27
+ namespace 'users', as: 'user' do
28
+ resource :privacy, only: [:edit, :update]
29
+ resource :email_preferences, only: [:edit, :update]
30
+ resources :external_accounts, only: [:index, :destroy]
31
+ end
32
+
33
+ resources :users, only: [:show] do
34
+ resources :followerships, only: [:create, :destroy], on: :member
35
+ get 'followers', controller: 'followerships'
36
+ get 'following', controller: 'followerships'
37
+ end
38
+
39
+ namespace :admin do
40
+ root 'dashboard#index'
41
+ resources :users, only: [:index, :show, :update]
42
+ end
43
+ end
@@ -0,0 +1,66 @@
1
+ class DeviseCreateRaddarUsers < ActiveRecord::Migration
2
+ def change
3
+ reversible do |dir|
4
+ dir.up do
5
+ enable_extension 'hstore'
6
+ end
7
+
8
+ dir.down do
9
+ disable_extension 'hstore'
10
+ end
11
+ end
12
+
13
+ create_table(:raddar_users) do |t|
14
+ ## Database authenticatable
15
+ t.string :email, :null => false, :default => ""
16
+ t.string :encrypted_password, :null => false, :default => ""
17
+
18
+ ## Recoverable
19
+ t.string :reset_password_token
20
+ t.datetime :reset_password_sent_at
21
+
22
+ ## Rememberable
23
+ t.datetime :remember_created_at
24
+
25
+ ## Trackable
26
+ t.integer :sign_in_count, :default => 0
27
+ t.datetime :current_sign_in_at
28
+ t.datetime :last_sign_in_at
29
+ t.string :current_sign_in_ip
30
+ t.string :last_sign_in_ip
31
+
32
+ ## Confirmable
33
+ t.string :confirmation_token
34
+ t.datetime :confirmed_at
35
+ t.datetime :confirmation_sent_at
36
+ t.string :unconfirmed_email # Only if using reconfirmable
37
+
38
+ ## Lockable
39
+ # t.integer :failed_attempts, :default => 0 # Only if lock strategy is :failed_attempts
40
+ # t.string :unlock_token # Only if unlock strategy is :email or :both
41
+ # t.datetime :locked_at
42
+
43
+ ## Token authenticatable
44
+ # t.string :authentication_token
45
+
46
+ t.string :name
47
+ t.string :location
48
+ t.date :birthday
49
+ t.string :gender
50
+ t.text :bio
51
+ t.string :state, default: 'active'
52
+ t.string :avatar
53
+ t.hstore :privacy
54
+ t.hstore :email_preferences
55
+
56
+ t.timestamps
57
+ end
58
+
59
+ add_index :raddar_users, :email, unique: true
60
+ add_index :raddar_users, :reset_password_token, unique: true
61
+ add_index :raddar_users, :name, unique: true
62
+ add_index :raddar_users, :confirmation_token, unique: true
63
+ # add_index :users, :unlock_token, :unique => true
64
+ # add_index :users, :authentication_token, :unique => true
65
+ end
66
+ end