diff --git a/Gemfile b/Gemfile index d90557c..bd0dd53 100644 --- a/Gemfile +++ b/Gemfile @@ -27,6 +27,8 @@ gem 'bootstrap-sass' gem 'devise' +gem 'slim-rails' + gem 'activeadmin', github: 'activeadmin' # Use ActiveModel has_secure_password # gem 'bcrypt', '~> 3.1.7' diff --git a/Gemfile.lock b/Gemfile.lock index 47357a8..df4964c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -176,6 +176,15 @@ GEM sdoc (0.4.1) json (~> 1.7, >= 1.7.7) rdoc (~> 4.0) + slim (3.0.6) + temple (~> 0.7.3) + tilt (>= 1.3.3, < 2.1) + slim-rails (3.0.1) + actionmailer (>= 3.1, < 5.0) + actionpack (>= 3.1, < 5.0) + activesupport (>= 3.1, < 5.0) + railties (>= 3.1, < 5.0) + slim (~> 3.0) spring (1.6.1) sprockets (3.5.2) concurrent-ruby (~> 1.0) @@ -185,6 +194,7 @@ GEM activesupport (>= 4.0) sprockets (>= 3.0.0) sqlite3 (1.3.11) + temple (0.7.6) thor (0.19.1) thread_safe (0.3.5) tilt (2.0.1) @@ -217,6 +227,7 @@ DEPENDENCIES rails (= 4.2.0) sass-rails (~> 5.0) sdoc (~> 0.4.0) + slim-rails spring sqlite3 turbolinks diff --git a/app/views/devise/confirmations/new.html.erb b/app/views/devise/confirmations/new.html.erb deleted file mode 100644 index 826672f..0000000 --- a/app/views/devise/confirmations/new.html.erb +++ /dev/null @@ -1,16 +0,0 @@ -

Resend confirmation instructions

- -<%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %> - <%= devise_error_messages! %> - -
- <%= f.label :email %>
- <%= f.email_field :email, autofocus: true, value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %> -
- -
- <%= f.submit "Resend confirmation instructions" %> -
-<% end %> - -<%= render "devise/shared/links" %> diff --git a/app/views/devise/confirmations/new.html.slim b/app/views/devise/confirmations/new.html.slim new file mode 100644 index 0000000..f9de75f --- /dev/null +++ b/app/views/devise/confirmations/new.html.slim @@ -0,0 +1,10 @@ +h2 Resend confirmation instructions += form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: {method: :post}) do |f| + = devise_error_messages! + .field + = f.label :email + br + = f.email_field :email, autofocus: true, value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) + .actions + = f.submit "Resend confirmation instructions" + = render "devise/shared/links" \ No newline at end of file diff --git a/app/views/devise/mailer/confirmation_instructions.html.erb b/app/views/devise/mailer/confirmation_instructions.html.erb deleted file mode 100644 index dc55f64..0000000 --- a/app/views/devise/mailer/confirmation_instructions.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -

Welcome <%= @email %>!

- -

You can confirm your account email through the link below:

- -

<%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %>

diff --git a/app/views/devise/mailer/confirmation_instructions.html.slim b/app/views/devise/mailer/confirmation_instructions.html.slim new file mode 100644 index 0000000..c3ea69a --- /dev/null +++ b/app/views/devise/mailer/confirmation_instructions.html.slim @@ -0,0 +1,4 @@ +p + | Welcome #{@email}! +p You can confirm your account email through the link below: +p= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) \ No newline at end of file diff --git a/app/views/devise/mailer/password_change.html.erb b/app/views/devise/mailer/password_change.html.erb deleted file mode 100644 index b41daf4..0000000 --- a/app/views/devise/mailer/password_change.html.erb +++ /dev/null @@ -1,3 +0,0 @@ -

Hello <%= @resource.email %>!

- -

We're contacting you to notify you that your password has been changed.

diff --git a/app/views/devise/mailer/password_change.html.slim b/app/views/devise/mailer/password_change.html.slim new file mode 100644 index 0000000..7cbc2a7 --- /dev/null +++ b/app/views/devise/mailer/password_change.html.slim @@ -0,0 +1,3 @@ +p + | Hello #{@resource.email}! +p We're contacting you to notify you that your password has been changed. \ No newline at end of file diff --git a/app/views/devise/mailer/reset_password_instructions.html.erb b/app/views/devise/mailer/reset_password_instructions.html.erb deleted file mode 100644 index f667dc1..0000000 --- a/app/views/devise/mailer/reset_password_instructions.html.erb +++ /dev/null @@ -1,8 +0,0 @@ -

Hello <%= @resource.email %>!

- -

Someone has requested a link to change your password. You can do this through the link below.

- -

<%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %>

- -

If you didn't request this, please ignore this email.

-

Your password won't change until you access the link above and create a new one.

diff --git a/app/views/devise/mailer/reset_password_instructions.html.slim b/app/views/devise/mailer/reset_password_instructions.html.slim new file mode 100644 index 0000000..9411f4d --- /dev/null +++ b/app/views/devise/mailer/reset_password_instructions.html.slim @@ -0,0 +1,6 @@ +p + | Hello #{@resource.email}! +p Someone has requested a link to change your password. You can do this through the link below. +p= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) +p If you didn't request this, please ignore this email. +p Your password won't change until you access the link above and create a new one. \ No newline at end of file diff --git a/app/views/devise/mailer/unlock_instructions.html.erb b/app/views/devise/mailer/unlock_instructions.html.erb deleted file mode 100644 index 41e148b..0000000 --- a/app/views/devise/mailer/unlock_instructions.html.erb +++ /dev/null @@ -1,7 +0,0 @@ -

Hello <%= @resource.email %>!

- -

Your account has been locked due to an excessive number of unsuccessful sign in attempts.

- -

Click the link below to unlock your account:

- -

<%= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token) %>

diff --git a/app/views/devise/mailer/unlock_instructions.html.slim b/app/views/devise/mailer/unlock_instructions.html.slim new file mode 100644 index 0000000..b577628 --- /dev/null +++ b/app/views/devise/mailer/unlock_instructions.html.slim @@ -0,0 +1,5 @@ +p + | Hello #{@resource.email}! +p Your account has been locked due to an excessive number of unsuccessful sign in attempts. +p Click the link below to unlock your account: +p= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token) \ No newline at end of file diff --git a/app/views/devise/passwords/edit.html.erb b/app/views/devise/passwords/edit.html.erb deleted file mode 100644 index 6a796b0..0000000 --- a/app/views/devise/passwords/edit.html.erb +++ /dev/null @@ -1,25 +0,0 @@ -

Change your password

- -<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %> - <%= devise_error_messages! %> - <%= f.hidden_field :reset_password_token %> - -
- <%= f.label :password, "New password" %>
- <% if @minimum_password_length %> - (<%= @minimum_password_length %> characters minimum)
- <% end %> - <%= f.password_field :password, autofocus: true, autocomplete: "off" %> -
- -
- <%= f.label :password_confirmation, "Confirm new password" %>
- <%= f.password_field :password_confirmation, autocomplete: "off" %> -
- -
- <%= f.submit "Change my password" %> -
-<% end %> - -<%= render "devise/shared/links" %> diff --git a/app/views/devise/passwords/edit.html.slim b/app/views/devise/passwords/edit.html.slim new file mode 100644 index 0000000..02985ef --- /dev/null +++ b/app/views/devise/passwords/edit.html.slim @@ -0,0 +1,19 @@ +h2 Change your password += form_for(resource, as: resource_name, url: password_path(resource_name), html: {method: :put}) do |f| + = devise_error_messages! + = f.hidden_field :reset_password_token + .field + = f.label :password, "New password" + br + - if @minimum_password_length + em + | (#{@minimum_password_length} characters minimum) + br + = f.password_field :password, autofocus: true, autocomplete: "off" + .field + = f.label :password_confirmation, "Confirm new password" + br + = f.password_field :password_confirmation, autocomplete: "off" + .actions + = f.submit "Change my password" + = render "devise/shared/links" \ No newline at end of file diff --git a/app/views/devise/passwords/new.html.erb b/app/views/devise/passwords/new.html.erb deleted file mode 100644 index 8892efe..0000000 --- a/app/views/devise/passwords/new.html.erb +++ /dev/null @@ -1,16 +0,0 @@ -

Forgot your password?

- -<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %> - <%= devise_error_messages! %> - -
- <%= f.label :email %>
- <%= f.email_field :email, autofocus: true %> -
- -
- <%= f.submit "Send me reset password instructions" %> -
-<% end %> - -<%= render "devise/shared/links" %> \ No newline at end of file diff --git a/app/views/devise/passwords/new.html.slim b/app/views/devise/passwords/new.html.slim new file mode 100644 index 0000000..cafcdea --- /dev/null +++ b/app/views/devise/passwords/new.html.slim @@ -0,0 +1,10 @@ +h2 Forgot your password? += form_for(resource, as: resource_name, url: password_path(resource_name), html: {method: :post}) do |f| + = devise_error_messages! + .field + = f.label :email + br + = f.email_field :email, autofocus: true + .actions + = f.submit "Send me reset password instructions" + = render "devise/shared/links" \ No newline at end of file diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb deleted file mode 100644 index d97124a..0000000 --- a/app/views/devise/registrations/edit.html.erb +++ /dev/null @@ -1,49 +0,0 @@ -

Edit <%= resource_name.to_s.humanize %>

- -<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %> - <%= devise_error_messages! %> - -
- <%= f.label :email %>
- <%= f.email_field :email, autofocus: true %> -
- - <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %> -
Currently waiting confirmation for: <%= resource.unconfirmed_email %>
- <% end %> - -
- <%= f.label :password %> (leave blank if you don't want to change it)
- <%= f.password_field :password, autocomplete: "off" %> -
- -
- <%= f.label :password_confirmation %>
- <%= f.password_field :password_confirmation, autocomplete: "off" %> -
- -
- <%= f.label :current_password %> (we need your current password to confirm your changes)
- <%= f.password_field :current_password, autocomplete: "off" %> -
- -
- <%= f.label :first_name %>
- <%= f.text_field :first_name %> -
- -
- <%= f.label :last_name %>
- <%= f.text_field :last_name %> -
- -
- <%= f.submit "Update" %> -
-<% end %> - -

Cancel my account

- -

Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %>

- -<%= link_to "Back", :back %> diff --git a/app/views/devise/registrations/edit.html.slim b/app/views/devise/registrations/edit.html.slim new file mode 100644 index 0000000..52a83a4 --- /dev/null +++ b/app/views/devise/registrations/edit.html.slim @@ -0,0 +1,39 @@ +h2 + | Edit #{resource_name.to_s.humanize} += form_for(resource, as: resource_name, url: registration_path(resource_name), html: {method: :put}) do |f| + = devise_error_messages! + .field + = f.label :email + br + = f.email_field :email, autofocus: true + - if devise_mapping.confirmable? && resource.pending_reconfirmation? + div + | Currently waiting confirmation for: #{resource.unconfirmed_email} + .field + = f.label :password + i (leave blank if you don't want to change it) + br + = f.password_field :password, autocomplete: "off" + .field + = f.label :password_confirmation + br + = f.password_field :password_confirmation, autocomplete: "off" + .field + = f.label :current_password + i (we need your current password to confirm your changes) + br + = f.password_field :current_password, autocomplete: "off" + .field + = f.label :first_name + br + = f.text_field :first_name + .field + = f.label :last_name + br + = f.text_field :last_name + .actions + = f.submit "Update" +h3 Cancel my account +p + | Unhappy? #{button_to "Cancel my account", registration_path(resource_name), data: {confirm: "Are you sure?"}, method: :delete} += link_to "Back", :back \ No newline at end of file diff --git a/app/views/devise/registrations/new.html.erb b/app/views/devise/registrations/new.html.erb deleted file mode 100644 index 2b177ba..0000000 --- a/app/views/devise/registrations/new.html.erb +++ /dev/null @@ -1,33 +0,0 @@ -

Sign up

- -<%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %> - <%= devise_error_messages! %> -
- <%= f.label :email %>
- <%= f.email_field :email, autofocus: true %> -
-
- <%= f.label :password %> - <% if @minimum_password_length %> - (<%= @minimum_password_length %> characters minimum) - <% end %>
- <%= f.password_field :password, autocomplete: "off" %> -
-
- <%= f.label :password_confirmation %>
- <%= f.password_field :password_confirmation, autocomplete: "off" %> -
-
- <%= f.label :first_name %>
- <%= f.text_field :first_name %> -
-
- <%= f.label :last_name %>
- <%= f.text_field :last_name %> -
-
- <%= f.submit "Sign up" %> -
-<% end %> - -<%= render "devise/shared/links" %> \ No newline at end of file diff --git a/app/views/devise/registrations/new.html.slim b/app/views/devise/registrations/new.html.slim new file mode 100644 index 0000000..9a271da --- /dev/null +++ b/app/views/devise/registrations/new.html.slim @@ -0,0 +1,29 @@ +h2 Sign up += form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| + = devise_error_messages! + .field + = f.label :email + br + = f.email_field :email, autofocus: true + .field + = f.label :password + - if @minimum_password_length + em + | (#{@minimum_password_length} characters minimum) + br + = f.password_field :password, autocomplete: "off" + .field + = f.label :password_confirmation + br + = f.password_field :password_confirmation, autocomplete: "off" + .field + = f.label :first_name + br + = f.text_field :first_name + .field + = f.label :last_name + br + = f.text_field :last_name + .actions + = f.submit "Sign up" + = render "devise/shared/links" \ No newline at end of file diff --git a/app/views/devise/sessions/new.html.erb b/app/views/devise/sessions/new.html.erb deleted file mode 100644 index 5f71f94..0000000 --- a/app/views/devise/sessions/new.html.erb +++ /dev/null @@ -1,32 +0,0 @@ -
-
- -

Log in

- -<%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %> -
- <%= f.label :email %>
- <%= f.email_field :email, autofocus: true %> -
- -
- <%= f.label :password %>
- <%= f.password_field :password, autocomplete: "off" %> -
- - <% if devise_mapping.rememberable? -%> -
- <%= f.check_box :remember_me %> - <%= f.label :remember_me %> -
- <% end -%> - -
- <%= f.submit "Log in" %> -
-<% end %> - -<%= render "devise/shared/links" %> - -
-
\ No newline at end of file diff --git a/app/views/devise/sessions/new.html.slim b/app/views/devise/sessions/new.html.slim new file mode 100644 index 0000000..668a21b --- /dev/null +++ b/app/views/devise/sessions/new.html.slim @@ -0,0 +1,19 @@ +.row + .col-md-4.col-md-offset-4 + h2 Log in + = form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| + .field + = f.label :email + br + = f.email_field :email, autofocus: true + .field + = f.label :password + br + = f.password_field :password, autocomplete: "off" + - if devise_mapping.rememberable? + .field + = f.check_box :remember_me + = f.label :remember_me + .actions + = f.submit "Log in" + = render "devise/shared/links" \ No newline at end of file diff --git a/app/views/devise/shared/_links.html.erb b/app/views/devise/shared/_links.html.erb deleted file mode 100644 index e6a3e41..0000000 --- a/app/views/devise/shared/_links.html.erb +++ /dev/null @@ -1,25 +0,0 @@ -<%- if controller_name != 'sessions' %> - <%= link_to "Log in", new_session_path(resource_name) %>
-<% end -%> - -<%- if devise_mapping.registerable? && controller_name != 'registrations' %> - <%= link_to "Sign up", new_registration_path(resource_name) %>
-<% end -%> - -<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %> - <%= link_to "Forgot your password?", new_password_path(resource_name) %>
-<% end -%> - -<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %> - <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %>
-<% end -%> - -<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %> - <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %>
-<% end -%> - -<%- if devise_mapping.omniauthable? %> - <%- resource_class.omniauth_providers.each do |provider| %> - <%= link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider) %>
- <% end -%> -<% end -%> diff --git a/app/views/devise/shared/_links.html.slim b/app/views/devise/shared/_links.html.slim new file mode 100644 index 0000000..f9cc87c --- /dev/null +++ b/app/views/devise/shared/_links.html.slim @@ -0,0 +1,19 @@ +- if controller_name != 'sessions' + = link_to "Log in", new_session_path(resource_name) + br +- if devise_mapping.registerable? && controller_name != 'registrations' + = link_to "Sign up", new_registration_path(resource_name) + br + - if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' + = link_to "Forgot your password?", new_password_path(resource_name) + br + - if devise_mapping.confirmable? && controller_name != 'confirmations' + = link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) + br + - if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' + = link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) + br + - if devise_mapping.omniauthable? + - resource_class.omniauth_providers.each do |provider| + = link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider) + br \ No newline at end of file diff --git a/app/views/devise/unlocks/new.html.erb b/app/views/devise/unlocks/new.html.erb deleted file mode 100644 index 16586bc..0000000 --- a/app/views/devise/unlocks/new.html.erb +++ /dev/null @@ -1,16 +0,0 @@ -

Resend unlock instructions

- -<%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %> - <%= devise_error_messages! %> - -
- <%= f.label :email %>
- <%= f.email_field :email, autofocus: true %> -
- -
- <%= f.submit "Resend unlock instructions" %> -
-<% end %> - -<%= render "devise/shared/links" %> diff --git a/app/views/devise/unlocks/new.html.slim b/app/views/devise/unlocks/new.html.slim new file mode 100644 index 0000000..c3d3d38 --- /dev/null +++ b/app/views/devise/unlocks/new.html.slim @@ -0,0 +1,10 @@ +h2 Resend unlock instructions += form_for(resource, as: resource_name, url: unlock_path(resource_name), html: {method: :post}) do |f| + = devise_error_messages! + .field + = f.label :email + br + = f.email_field :email, autofocus: true + .actions + = f.submit "Resend unlock instructions" + = render "devise/shared/links" \ No newline at end of file diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb deleted file mode 100644 index c90d421..0000000 --- a/app/views/layouts/application.html.erb +++ /dev/null @@ -1,12 +0,0 @@ - - - - user tasks - <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> - <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> - <%= csrf_meta_tags %> - - -<%= yield %> - - \ No newline at end of file diff --git a/app/views/layouts/application.html.slim b/app/views/layouts/application.html.slim new file mode 100644 index 0000000..ba48f4a --- /dev/null +++ b/app/views/layouts/application.html.slim @@ -0,0 +1,10 @@ +doctype html +html lang="en" + head + meta content=("text/html; charset=UTF-8") http-equiv="Content-Type" / + title user tasks + = stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true + = javascript_include_tag 'application', 'data-turbolinks-track' => true + = csrf_meta_tags + body + = yield \ No newline at end of file diff --git a/app/views/tasks/_form.html.erb b/app/views/tasks/_form.html.erb deleted file mode 100644 index 6c749f2..0000000 --- a/app/views/tasks/_form.html.erb +++ /dev/null @@ -1,20 +0,0 @@ -<%= form_for @task do |f| %> - - <% if @task.errors.any? %> -

- <%= @task.errors.full_messages.to_sentence %> -

- <% end %> - <%= f.select :project_id, options_from_collection_for_select(@projects, :id, :name) %> -

- <%= f.label :taskname %>
- <%= f.text_field :taskname %> -

-

- <%= f.label :description %>
- <%= f.text_area :description %> -

-

- <%= f.submit %> -

-<% end %> \ No newline at end of file diff --git a/app/views/tasks/_form.html.slim b/app/views/tasks/_form.html.slim new file mode 100644 index 0000000..0976925 --- /dev/null +++ b/app/views/tasks/_form.html.slim @@ -0,0 +1,14 @@ += form_for @task do |f| + - if @task.errors.any? + h2 = @task.errors.full_messages.to_sentence + = f.select :project_id, options_from_collection_for_select(@projects, :id, :name) + p + = f.label :taskname + br + = f.text_field :taskname + p + = f.label :description + br + = f.text_area :description + p + = f.submit \ No newline at end of file diff --git a/app/views/tasks/_header.erb b/app/views/tasks/_header.erb deleted file mode 100644 index 7b813f8..0000000 --- a/app/views/tasks/_header.erb +++ /dev/null @@ -1,5 +0,0 @@ -
-

<%= t('tasks.index.task_list') %>

-
<%= t('tasks.index.hello') %><%= current_user.email %> - <%= link_to t('tasks.index.out'), destroy_user_session_path, :method => :delete %>
-

\ No newline at end of file diff --git a/app/views/tasks/_header.html.slim b/app/views/tasks/_header.html.slim new file mode 100644 index 0000000..7378deb --- /dev/null +++ b/app/views/tasks/_header.html.slim @@ -0,0 +1,8 @@ +.row + .col-md-4.col-md-offset-4 + h1 = t('tasks.index.task_list') + .col-md-2.col-md-offset-2 + = t('tasks.index.hello') + = current_user.email + = link_to t('tasks.index.out'), destroy_user_session_path, :method => :delete +br \ No newline at end of file diff --git a/app/views/tasks/edit.html.erb b/app/views/tasks/edit.html.erb deleted file mode 100644 index ddef98d..0000000 --- a/app/views/tasks/edit.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -

<%= t(:edit) %>

- -<%= render 'form' %> - -<%= link_to t(:back), tasks_path %> \ No newline at end of file diff --git a/app/views/tasks/edit.html.slim b/app/views/tasks/edit.html.slim new file mode 100644 index 0000000..c00effd --- /dev/null +++ b/app/views/tasks/edit.html.slim @@ -0,0 +1,3 @@ +h1 = t(:edit) += render 'form' += link_to t(:back), tasks_path \ No newline at end of file diff --git a/app/views/tasks/index.html.erb b/app/views/tasks/index.html.erb deleted file mode 100644 index 4585eca..0000000 --- a/app/views/tasks/index.html.erb +++ /dev/null @@ -1,51 +0,0 @@ -<%= render 'header' %> - -
- <%= form_for @task, url: tasks_path do |f| %> - <% if @task.errors.any? %> -
-
- <%= @task.errors.full_messages.to_sentence %> -
- <% end %> -

-
-
- <%= f.select :project_id, options_from_collection_for_select(@projects, :id, :name)%> -
-
- <%= f.text_field :taskname, placeholder: 'Taskname', class: "width_100" %> -
-
- <%= f.text_field :description, placeholder: 'Description', class: "width_100" %> -
-
- <%= f.submit %> -
-
- <% end %> -

- - - - - - - - - - - <% @tasks.each do |task| %> - - - - - - - - - - <% end %> -
<%= t(:user) %><%= t(:project) %><%= t(:task_name) %><%= t(:description) %>
<%= task.user.full_name %><%= task.project.name %><%= task.taskname %><%= task.description %><%= link_to t(:show), task_path(task) %><%= link_to t(:edit), edit_task_path(task) %><%= link_to t(:destroy), task_path(task), - method: :delete, - data: { confirm: 'Are you sure?' } %>
\ No newline at end of file diff --git a/app/views/tasks/index.html.slim b/app/views/tasks/index.html.slim new file mode 100644 index 0000000..afd3da5 --- /dev/null +++ b/app/views/tasks/index.html.slim @@ -0,0 +1,36 @@ += render 'header' +.container-fluid + = form_for @task, url: tasks_path do |f| + - if @task.errors.any? + .row + .col-md-5 + = @task.errors.full_messages.to_sentence + br + .row + .col-md-1.col-md-offset-2 + = f.select :project_id, options_from_collection_for_select(@projects, :id, :name) + .col-md-2 + = f.text_field :taskname, placeholder: I18n.t('tasks.index.task_name'), class: "width_100" + .col-md-4 + = f.text_field :description, placeholder: I18n.t('tasks.index.description'), class: "width_100" + .col-md-1 + = f.submit +br +table.table.table-bordered + tr.info + th = t(:user) + th = t(:project) + th = t(:task_name) + th = t(:description) + th[colspan="3"] + - @tasks.each do |task| + tr.active + td = task.user.full_name + td = task.project.name + td = task.taskname + td = task.description + td = link_to t(:show), task_path(task) + td = link_to t(:edit), edit_task_path(task) + td = link_to t(:destroy), task_path(task), + method: :delete, + data: { confirm: 'Are you sure?' } \ No newline at end of file diff --git a/app/views/tasks/new.html.erb b/app/views/tasks/new.html.erb deleted file mode 100644 index a6116fe..0000000 --- a/app/views/tasks/new.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -

<%= t(:new_task) %>

- -<%= render 'form' %> - -<%= link_to t(:back), tasks_path %> \ No newline at end of file diff --git a/app/views/tasks/new.html.slim b/app/views/tasks/new.html.slim new file mode 100644 index 0000000..b33f574 --- /dev/null +++ b/app/views/tasks/new.html.slim @@ -0,0 +1,3 @@ +h1 = t(:new_task) += render 'form' += link_to t(:back), tasks_path \ No newline at end of file diff --git a/app/views/tasks/show.html.erb b/app/views/tasks/show.html.erb deleted file mode 100644 index ff4e307..0000000 --- a/app/views/tasks/show.html.erb +++ /dev/null @@ -1,25 +0,0 @@ -
-
-

<%= t(:show) %>

-
-
-
<%= t(:task_name) %> - <%= @task.taskname %>
-
-
-
<%= t(:description) %> - <%= @task.description %>
-
-
-
<%= t(:user) %> - <%= @task.user.full_name %>
-
-
-
<%= t(:project) %> - <%= @task.project.name %>
-
-
-
<%= link_to t(:edit), edit_task_path(@task) %> | - <%= link_to t(:back), tasks_path %>
-
-
\ No newline at end of file diff --git a/app/views/tasks/show.html.slim b/app/views/tasks/show.html.slim new file mode 100644 index 0000000..370a949 --- /dev/null +++ b/app/views/tasks/show.html.slim @@ -0,0 +1,25 @@ +.container-fluid + .row + .col-md-4.col-md-offset-4 + h1 = t(:show) + .row + .col-md-4.col-md-offset-4 + strong = t(:task_name) + = @task.taskname + .row + .col-md-4.col-md-offset-4 + strong = t(:description) + = @task.description + .row + .col-md-4.col-md-offset-4 + strong = t(:user) + = @task.user.full_name + .row + .col-md-4.col-md-offset-4 + strong = t(:project) + = @task.project.name + .row + .col-md-4.col-md-offset-4 + = link_to t(:edit), edit_task_path(@task) + | | + = link_to t(:back), tasks_path \ No newline at end of file diff --git a/config/application.rb b/config/application.rb index abf6197..360c7a6 100644 --- a/config/application.rb +++ b/config/application.rb @@ -8,6 +8,9 @@ module TheTask class Application < Rails::Application + config.generators do |g| + g.template_engine :slim + end # Settings in config/environments/* take precedence over those specified here. # Application configuration should go into files in config/initializers # -- all .rb files in that directory are automatically loaded.