diff --git a/app/views/comments/_comment.html.erb b/app/views/comments/_comment.html.erb index beaf271..656ae21 100644 --- a/app/views/comments/_comment.html.erb +++ b/app/views/comments/_comment.html.erb @@ -1,4 +1,11 @@
-

<%= comment.user.username %> -

- <%= simple_format comment.body %> +

+ + <%= comment.user.username %> + - +

+ <%= simple_format comment.body %>
\ No newline at end of file diff --git a/app/views/comments/_form.html.erb b/app/views/comments/_form.html.erb index afb9c82..508a744 100644 --- a/app/views/comments/_form.html.erb +++ b/app/views/comments/_form.html.erb @@ -3,11 +3,14 @@ <%= form_for(@comment) do |f| %> <% if @comment.errors.any? %>
-

<%= pluralize(@comment.errors.count, "error") %> prohibited this comment from being saved:

+

+ <%= pluralize(@comment.errors.count, "error") %> + <%= t('post.error_explanation')%> +

<% end %> diff --git a/app/views/pages/home.html.erb b/app/views/pages/home.html.erb index e4bc52a..57f42dc 100644 --- a/app/views/pages/home.html.erb +++ b/app/views/pages/home.html.erb @@ -10,7 +10,6 @@
-
<%= link_to t('post.new_post'), new_post_path, class: 'btn btn-primary pull-right' %> @@ -19,19 +18,19 @@ <%= render 'posts/list' %>
-
- <% if signed_in? %>

<%= t('digest_email.digest') %>

<% if current_user.digest_subscriber %> -

<%= t('digest_email.subscribe') %><%= t("digest_email.#{ current_user.digest_frequency }") %> digest emails.

+

<%= t('digest_email.subscribe') %> + <%= current_user.digest_frequency %> + <%= t('digest_email.end') %>

<% else %> -

Sign up for an email digest so you never miss a thing!

+

<%= t('digest_email.sign_') %>

<%= form_for current_user, html: {id:'digest_signup_form', class: 'form-inline'} do |f| %> <%= hidden_field_tag :redirect_to, root_path %> <%= f.hidden_field :digest_subscriber, value: 1 %> @@ -49,7 +48,8 @@
- <%= f.submit t('digest_email.subscribe_email'), class: 'btn btn-primary' %> + <%= f.submit t('digest_email.subscribe_button'), + class: 'btn btn-primary' %> <% end %> <% end %>
diff --git a/app/views/posts/_form.html.erb b/app/views/posts/_form.html.erb index e8de929..6f86b2e 100644 --- a/app/views/posts/_form.html.erb +++ b/app/views/posts/_form.html.erb @@ -1,7 +1,10 @@ <%= form_for(@post, url: (@post.new_record? ? posts_path : post_path(@post)), as: :internal_post) do |f| %> <% if @post.errors.any? %>
-

<%= pluralize(@post.errors.count, "error") %> prohibited this post from being saved:

+

+ <%= pluralize(@post.errors.count, "error") %> + <%= t('post.error_explanation')%> +

    <% @post.errors.full_messages.each do |msg| %> @@ -17,14 +20,14 @@
- <%= f.label ('new_post.body_markdown') %> + <%= f.label t('post.body_markdown') %> <%= f.text_area :body_markdown, class: 'form-control', rows: 5 %>
- <%= f.label :tags_string, t('new_post.tag') %> + <%= f.label :tags_string, t('post.tag') %> <%= f.text_field :tags_string, class: 'form-control' %>
- <%= f.submit nil, class: 'btn btn-default' %> + <%= f.submit t('post.submit_value'), class: 'btn btn-default' %> <% end %> diff --git a/app/views/posts/_list.html.erb b/app/views/posts/_list.html.erb index 17e3433..87848f9 100644 --- a/app/views/posts/_list.html.erb +++ b/app/views/posts/_list.html.erb @@ -4,12 +4,20 @@ <%= link_to_post(post) %> -
Submitted by <%= post.username %> on <%= post.created_at.strftime("%m/%d/%Y") %> +
+ <%= t('post.submitted') %> + <%= post.username %> + <%=t('post._on') %> + <%= post.created_at.strftime("%m/%d/%Y")%> +
<%= render 'posts/tags', post: post %> <%= render 'votes/vote', post: post %> - <%= post.number_of_comments %> + + <%= post.number_of_comments %> + <% end %> diff --git a/app/views/posts/show.html.erb b/app/views/posts/show.html.erb index 307a480..92eb8d3 100644 --- a/app/views/posts/show.html.erb +++ b/app/views/posts/show.html.erb @@ -12,12 +12,15 @@

- Posted by: <%= @post.user.username %> on <%= @post.created_at.strftime("%m/%d/%Y") %> + <%= t('post.posted_by')%> + <%= @post.user.username %> + <%= t('post._on')%> + <%= @post.created_at.strftime("%m/%d/%Y") %> <% if policy(@post).update? %> - | <%= link_to 'Edit', edit_post_path(@post) %> + | <%= link_to t('post.edit'), edit_post_path(@post) %> <% end %> <% if policy(@post).destroy? %> - | <%= link_to 'Destroy', post_path(@post), method: :delete, data: { confirm: 'Are you sure?' } %> + | <%= link_to t('post.destroy'), post_path(@post), method: :delete, data: { confirm: t('post.confirm') } %> <% end %>

@@ -27,7 +30,7 @@ <%= render 'tags', post: @post %> -

Comments

+

<%= t('post.comments') %>

<%= render 'comments/form' %> <% @post.comments.each do |comment| %> diff --git a/app/views/tags/index.html.erb b/app/views/tags/index.html.erb index a4c9d5e..5689d14 100644 --- a/app/views/tags/index.html.erb +++ b/app/views/tags/index.html.erb @@ -1,4 +1,4 @@ -

Tags List

+

<%= t('tags_list')%>

diff --git a/app/views/tags/show.html.erb b/app/views/tags/show.html.erb index deeaeb9..da2946a 100644 --- a/app/views/tags/show.html.erb +++ b/app/views/tags/show.html.erb @@ -1,4 +1,10 @@ -

Post List For <%= @tag.title %> Tag

+

+ <%= t('tags_for')%> + + <%= @tag.title %> + + <%= t('tag')%> +

<%= render 'posts/list' %> diff --git a/app/views/users/edit_current_user.html.erb b/app/views/users/edit_current_user.html.erb index d7cee60..5782aca 100644 --- a/app/views/users/edit_current_user.html.erb +++ b/app/views/users/edit_current_user.html.erb @@ -1,22 +1,22 @@
-

My Account

+

<%= t('user.my_account')%>

<%= form_for current_user do |f| %>
- <%= f.label :username, 'Display Name' %> + <%= f.label :username, t('user.display_name') %> <%= f.text_field :username, class: 'form-control input-lg', style: 'max-width: 15em' %>
- <%= f.label :email %> + <%= f.label :email, t('user.email') %> <%= f.text_field :email, class: 'form-control input-md' %>
- <%= f.submit 'Save', class: 'btn btn-primary btn-md' %> + <%= f.submit t('user.submit_button_save'), class: 'btn btn-primary btn-md' %>
<% end %> diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb index 6cddb0b..ae37716 100644 --- a/app/views/users/new.html.erb +++ b/app/views/users/new.html.erb @@ -6,11 +6,13 @@
<% if @user.errors.any? %>
-

<%= pluralize(@user.errors.count, "error") %> prohibited this account from being created:

+

+ <%= pluralize(@user.errors.count, "error") %>prohibited this account from being created: +

    - <% @user.errors.full_messages.each do |msg| %> -
  • <%= msg %>
  • - <% end %> + <% @user.errors.full_messages.each do |msg| %> +
  • <%= msg %>
  • + <% end %>
<% end %> diff --git a/app/views/votes/_vote.html.erb b/app/views/votes/_vote.html.erb index 2718b39..e4264c7 100644 --- a/app/views/votes/_vote.html.erb +++ b/app/views/votes/_vote.html.erb @@ -4,20 +4,20 @@

<%= post.votes.count %>
- votes + <%= t('votes.votes')%>
<% else %> <%= link_to vote_post_path(post), method: :put do %>
<%= post.votes.count %>
- votes + <%= t('votes.votes')%> <% end %> <% end %> <% else %>

<%= post.votes.count %>
- votes + <%= t('votes.votes')%>
<% end %>
diff --git a/config/locales/en.yml b/config/locales/en.yml index 4a561b2..b019966 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -21,27 +21,62 @@ en: hello: "Hello world" + post: - latest_post: "Latest Post"#pendiente de revisar - tag: "Tags" - title: "title" - body_markdown: "body_markdown" + # home + welcome: "Welcome to RubyGameDev.com, the community-driven, information hub which helps others to build games in Ruby! First time here? " + latest_post: "Latest Post" # pendiente de revisar + submitted: "Submitted by " + _on: "on" + edit_post: "Editing Post" result: "No result found" + + # new post new_post: "New Post" - welcome: "Welcome to RubyGameDev.com, the community-driven, information hub which helps others to build games in Ruby! First time here? " + error_explanation: "prohibited this post from being saved:" + title: "title" + body_markdown: "body_markdown" + tag: "Tags" + submit_value: "Create Post" + + #show post + posted_by: "Posted by:" + destroy: "Destroy" + confirm: "Are you sure?" + edit: "Edit" + comments: "Comments" + comment: add_comment: "Add Comment" discussion: "to participate in the discussion!" create_account: "Create an Account" + digest_email: digest: "Digest Email" subscribe: "You are signed up to receive" + end: " digest emails." daily: " Daily" weekly: " Weekly" monthly: " Monthly" email_example: "email@example.com" - subscribe_email: "Subscribe" + subscribe_button: "Subscribe" + sign_up: Sign up for an email digest so you never miss a thing! + social_network: github: "Help Out on GitHub" - twitter: "Follow %{count}" \ No newline at end of file + twitter: "Follow %{count}" + + votes: + votes: "votes" + + tags: + tags_list: "Tags List" + tags_for: "Post List For" + tag: "Tag" + + user: + my_account: "My Account" + disply_name: "Display name" + email: "Email" + submit_button_save: "Save" \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index a7058da..7b66095 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -3,28 +3,24 @@ get '/auth/failure', to: 'sessions#auth_failure' root 'pages#home' + + resources :users, only: [:create, :edit, :update] + get '/account' => 'users#edit_current_user', as: :account - scope "/locate" do - get '/locate' => 'pages#home' - - resources :users, only: [:create, :edit, :update] - get '/account' => 'users#edit_current_user', as: :account - - resources :posts do - member do - put :vote - end + resources :posts do + member do + put :vote end + end - resources :comments - resources :tags + resources :comments + resources :tags - resources :libraries - resources :library_categories + resources :libraries + resources :library_categories - get 'about' => 'pages#about', as: :about_page + get 'about' => 'pages#about', as: :about_page - # Short Links - get ':id' => 'short_links#post', as: :post_short_link, constraints: { id: /\d+/ } - end -end + # Short Links + get ':id' => 'short_links#post', as: :post_short_link, constraints: { id: /\d+/ } +end \ No newline at end of file diff --git a/spec/mailers/comment_mailer_spec.rb b/spec/mailers/comment_mailer_spec.rb deleted file mode 100644 index 3a70eef..0000000 --- a/spec/mailers/comment_mailer_spec.rb +++ /dev/null @@ -1,34 +0,0 @@ -require "rails_helper" - -describe CommentMailer do - describe "#send_new_comment_notification" do - let!(:comment) { FactoryGirl.create(:comment) } - let(:mail) { CommentMailer.send_notification_email(comment.id) } - - it "renders the subject" do - expect(mail.subject).to eql('Notification comment') - end - - it "renders the receiver email" do - expect(mail.to).to eql([comment.parent.user.email]) - end - - it "renders the sender email" do - expect(mail.from).to eql(["no-reply@rubygamedev.com"]) - end - - it "assigns @name" do - expect(mail.body.encoded).to match(comment.parent.user.username) - end - - it "assigns @confirmation_url" do - expect(mail.body.encoded).to match( - "https://www.rubygamedev.com/posts/#{comment.parent_id}") - end - - it "render the body email" do - expect(comment.body).to match( - "hello this is the body of comment") - end - end -end diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 481f1d4..5ac5b07 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -54,4 +54,12 @@ config.include Capybara::DSL config.include Support::Features + + Capybara.register_driver :webkit do |app| + Capybara::Selenium::Driver.new(app, :browser => :chrome) + end + + Capybara.javascript_driver = :webkit + end +