Skip to content

Commit 068618c

Browse files
committed
User form changes
- Added few fields to user form - Updated some fields as readonly - Modified the params for newly added fields
1 parent 4d3bea6 commit 068618c

File tree

3 files changed

+19
-10
lines changed

3 files changed

+19
-10
lines changed

app/controllers/light/users_controller.rb

+5-2
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,10 @@ def thank_you
139139

140140
private
141141
def users_params
142-
params.require(:user).permit(:id, :email_id, :is_subscribed, :joined_on, :source, :username)
142+
params.require(:user).permit(
143+
:id, :email_id, :is_subscribed, :joined_on, :is_blocked,
144+
:sidekiq_status, :source, :username
145+
)
143146
end
144147

145148
def user_with_token
@@ -154,7 +157,7 @@ def response_message(status)
154157
if dummy_token?
155158
"#{status.capitalize} successfully!!"
156159
elsif @user.nil?
157-
"Hey, it seems request you are trying to access is invalid. If you have any " +
160+
"Hey, it seems request you are trying to access is invalid. If you have any " +
158161
"concerns about our newsletter's subscription, kindly get in touch with " +
159162
"<a href='mailto:[email protected]' class='email'>[email protected]</a>"
160163
else

app/views/light/users/edit.html.haml

+12-6
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,18 @@
44
%table
55
%tr
66
%td
7-
= f.input :email_id, input_html:{class: 'span3'}
8-
= f.input :username, input_html:{class: 'span3'}
9-
= f.input :is_subscribed, :as => :select, input_html:{class: 'span3'}
10-
= f.input :joined_on, input_html: { 'data-behaviour' => 'datepicker'}, input_html:{class: 'span3'}
11-
= f.input :source, input_html:{class: 'span3'}
12-
= f.button :submit, class: "btn btn-success controls"
7+
= f.input :email_id, input_html: {class: 'span3'}
8+
= f.input :username, input_html: {class: 'span3'}
9+
= f.input :sent_on, input_html: {class: 'span3', readonly: true}
10+
= f.input :source, input_html: {class: 'span3', readonly: true}
11+
= f.input :joined_on, input_html: { 'data-behaviour': 'datepicker'}, input_html:{class: 'span3', readonly: true}
12+
= f.input :subscribed_at, input_html: {class: 'span3', readonly: true}
13+
= f.input :unsubscribed_at, input_html: {class: 'span3', readonly: true}
14+
= f.input :opt_in_mail_sent_at, input_html: {class: 'span3', readonly: true}
15+
= f.input :sidekiq_status, input_html:{class: 'span3'}
16+
= f.input :is_blocked, as: :select, input_html: {class: 'span3'}, include_blank: false
17+
= f.input :is_subscribed, as: :select, input_html: {class: 'span3'}, include_blank: false
18+
= f.button :submit, class: 'btn btn-success controls'
1319

1420
:javascript
1521
$('[data-behaviour~=datepicker]').datepicker({

app/views/light/users/index.html.haml

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@
5151
%td.text-center= '{{email_id}}'
5252
%td.text-center= '{{username}}'
5353
%td.text-center
54-
%a{ :href => "/newsletter/users/{{_id.$oid}}/edit", :class => 'btn btn-sm btn-success'} Edit
54+
%a{ :href => "/newsletter/users/{{id}}/edit", :class => 'btn btn-sm btn-success'} Edit
5555

56-
%a{ :href => "/newsletter/users/{{_id.$oid}}", data:{ :confirm => 'Are you sure?', method: 'delete'}, :class => 'btn btn-sm btn-danger' } Delete
56+
%a{ :href => "/newsletter/users/{{id}}", data:{ :confirm => 'Are you sure?', method: 'delete'}, :class => 'btn btn-sm btn-danger' } Delete
5757

5858
.col-lg-12.padding_none.pull-right
5959
#user_pagination.col-lg-12

0 commit comments

Comments
 (0)