Skip to content

Commit

Permalink
User form changes
Browse files Browse the repository at this point in the history
- Added few fields to user form
- Updated some fields as readonly
- Modified the params for newly added fields
  • Loading branch information
tejaszambre committed Dec 29, 2020
1 parent 4d3bea6 commit 068618c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
7 changes: 5 additions & 2 deletions app/controllers/light/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,10 @@ def thank_you

private
def users_params
params.require(:user).permit(:id, :email_id, :is_subscribed, :joined_on, :source, :username)
params.require(:user).permit(
:id, :email_id, :is_subscribed, :joined_on, :is_blocked,
:sidekiq_status, :source, :username
)
end

def user_with_token
Expand All @@ -154,7 +157,7 @@ def response_message(status)
if dummy_token?
"#{status.capitalize} successfully!!"
elsif @user.nil?
"Hey, it seems request you are trying to access is invalid. If you have any " +
"Hey, it seems request you are trying to access is invalid. If you have any " +
"concerns about our newsletter's subscription, kindly get in touch with " +
"<a href='mailto:[email protected]' class='email'>[email protected]</a>"
else
Expand Down
18 changes: 12 additions & 6 deletions app/views/light/users/edit.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,18 @@
%table
%tr
%td
= f.input :email_id, input_html:{class: 'span3'}
= f.input :username, input_html:{class: 'span3'}
= f.input :is_subscribed, :as => :select, input_html:{class: 'span3'}
= f.input :joined_on, input_html: { 'data-behaviour' => 'datepicker'}, input_html:{class: 'span3'}
= f.input :source, input_html:{class: 'span3'}
= f.button :submit, class: "btn btn-success controls"
= f.input :email_id, input_html: {class: 'span3'}
= f.input :username, input_html: {class: 'span3'}
= f.input :sent_on, input_html: {class: 'span3', readonly: true}
= f.input :source, input_html: {class: 'span3', readonly: true}
= f.input :joined_on, input_html: { 'data-behaviour': 'datepicker'}, input_html:{class: 'span3', readonly: true}
= f.input :subscribed_at, input_html: {class: 'span3', readonly: true}
= f.input :unsubscribed_at, input_html: {class: 'span3', readonly: true}
= f.input :opt_in_mail_sent_at, input_html: {class: 'span3', readonly: true}
= f.input :sidekiq_status, input_html:{class: 'span3'}
= f.input :is_blocked, as: :select, input_html: {class: 'span3'}, include_blank: false
= f.input :is_subscribed, as: :select, input_html: {class: 'span3'}, include_blank: false
= f.button :submit, class: 'btn btn-success controls'

:javascript
$('[data-behaviour~=datepicker]').datepicker({
Expand Down
4 changes: 2 additions & 2 deletions app/views/light/users/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@
%td.text-center= '{{email_id}}'
%td.text-center= '{{username}}'
%td.text-center
%a{ :href => "/newsletter/users/{{_id.$oid}}/edit", :class => 'btn btn-sm btn-success'} Edit
%a{ :href => "/newsletter/users/{{id}}/edit", :class => 'btn btn-sm btn-success'} Edit

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

.col-lg-12.padding_none.pull-right
#user_pagination.col-lg-12
Expand Down

0 comments on commit 068618c

Please sign in to comment.