Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i18n improvements #6

Open
wants to merge 15 commits into
base: next
Choose a base branch
from
6 changes: 3 additions & 3 deletions app/controllers/answers_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class AnswersController < ApplicationController
before_filter :login_required, :except => [:show, :create, :index]
before_filter :login_required, :except => [:show, :index]
before_filter :check_permissions, :only => [:destroy]
before_filter :check_update_permissions, :only => [:edit, :update, :revert]

Expand Down Expand Up @@ -72,7 +72,7 @@ def show
def create
@answer = Answer.new
@answer.safe_update(%w[body wiki anonymous position], params[:answer])
@answer.anonymous = params[:answer][:anonymous]
@answer.anonymous = params[:answer][:anonymous] || !logged_in?
@question = current_group.questions.by_slug(params[:question_id])

@answer.question = @question
Expand Down Expand Up @@ -130,7 +130,7 @@ def create
end
else
@answer.errors.add(:captcha, "is invalid") if !logged_in? && !recaptcha_valid?

errors = @answer.errors
errors.merge!(@answer.user.errors) if @answer.user.anonymous && !@answer.user.valid?
puts errors.full_messages
Expand Down
2 changes: 1 addition & 1 deletion app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class User

field :preferred_languages, :type => Array, :default => []

field :language, :type => String, :default => "en"
field :language, :type => String, :default => "ru"
index :language
field :timezone, :type => String
field :language_filter, :type => String, :default => "user", :in => LANGUAGE_FILTERS
Expand Down
24 changes: 24 additions & 0 deletions app/stylesheets/app/_drop-menus.sass
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,30 @@ ul.sf-menu
width: 175px

ul
background-color: white
form
size: 14px
max-width: 172px
background-color: white
margin: 0px
padding: 2px 1px 2px 2px
.field
margin-bottom: -3px
input
width: 149px
.buttons
margin-bottom: 3px
padding-right: 5px
button
background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #d05800), color-stop(1, #ee681f)) !important
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='$orange', endColorstr='$darkOrange')" !important
background-color: #ee681f
border: none
font-size: 14px
padding: 5px 10px
float: right
color: white
width: auto
+menu-shadow
li
float: left !important
Expand Down
2 changes: 1 addition & 1 deletion app/stylesheets/app/_footer.sass
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ footer
border-top: 1px solid #ccc
text-align: center
ul
width: 550px
width: 650px
margin: 0 auto
li:first-child
a
Expand Down
2 changes: 1 addition & 1 deletion app/views/badges/index.html.haml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
%h1
Badges
#{t '.title'}
%p.description
= t(".description")
.content
Expand Down
10 changes: 5 additions & 5 deletions app/views/devise/sessions/_login.html.haml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
- form_tag session_path, :class => "form" do
= form_tag new_user_session_path do
.field
= label_tag 'login', t(:login, :scope => "activerecord.attributes.user"), :class => "label"
= text_field_tag 'login', @login, :class => "text_field"
= label_tag 'email', t(:email, :scope => "activerecord.attributes.user"), :class => "label"
= text_field_tag 'user[email]'
.field
= label_tag 'password', t(:password, :scope => "activerecord.attributes.user"), :class => "label"
= password_field_tag 'password', nil, :class => "text_field"
= password_field_tag 'user[password]'
.buttons
= submit_tag t("sessions.new.log_in"), :class => "button"
%button #{t 'sessions.new.log_in'}
11 changes: 4 additions & 7 deletions app/views/devise/sessions/new.html.haml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
%h1
Login to (Group Name)
//i18n
%h1 #{t '.login'}
%p.description
We help you discover and share opinions that is the most relevant to you and those in your group.
//i18n
#{t '.descr'}

= multiauth_assets

Expand All @@ -12,7 +9,6 @@
-if current_group.registered_only
.error
IMPORTANT: You must be logged in to see this site
//i18n

-unless current_group.is_noemail_signup?
-form_for :user, resource, :url => session_path(resource_name), :html => {:class => "form"} do |f|
Expand All @@ -28,8 +24,9 @@
=f.check_box :remember_me
=f.label :remember_me, t(".remember_me")


.buttons
=f.submit "Sign in", :class => "save"
=f.submit "#{t 'sessions.new.log_in'}", :class => "save"


= render :partial => "shared/devise_links"
8 changes: 3 additions & 5 deletions app/views/groups/_top_grouplist.html.haml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
%li.group
%small
// TODO I18n
Active site:
= link_to current_group.name
#{t 'groups.top.active'}
= link_to "#{t 'groups.top.jkh'}"
%ul
-if logged_in?
-current_user.groups.only(:name).limit(10).all.each do |group|
Expand All @@ -11,6 +11,4 @@
-else
-Group.where(:state => "active", :private => false).order_by([:activity_rate, :desc]).limit(10).all.each do |group|
%li
= link_to group.name, group_path(group)
%li
= link_to t(".request_group"), new_group_path
= link_to "#{t 'groups.top.jkh'}", group_path(group)
27 changes: 10 additions & 17 deletions app/views/layouts/application.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@
.widget-links.module
%nav
%ul
= tab_entry "li", "All", questions_path, :selected => "active"
= tab_entry "li", "#{t 'layouts.application.menu.all'}", questions_path, :selected => "active"
-if logged_in?
= tab_entry "li", "Followed", feed_user_path(current_user), :selected => "active"
= tab_entry "li", "By Me", by_me_user_path(current_user), :selected => "active"
= tab_entry "li", "Preferred", preferred_user_path(current_user), :selected => "active"
= tab_entry "li", "Contributed", contributed_user_path(current_user), :selected => "active"
= tab_entry "li", "Collaborate!", expertise_user_path(current_user), :selected => "active"
= tab_entry "li", "#{t 'layouts.application.menu.followed'}", feed_user_path(current_user), :selected => "active"
= tab_entry "li", "#{t 'layouts.application.menu.myne'}", by_me_user_path(current_user), :selected => "active"
= tab_entry "li", "#{t 'layouts.application.menu.preferred'}", preferred_user_path(current_user), :selected => "active"
= tab_entry "li", "#{t 'layouts.application.menu.contributed'}", contributed_user_path(current_user), :selected => "active"
= tab_entry "li", "#{t 'layouts.application.menu.collaborate'}", expertise_user_path(current_user), :selected => "active"
%li
=link_to "FAQ"

Expand All @@ -66,16 +66,16 @@
%nav
%ul
%li
= link_to "Random question", random_questions_path(:unanswered => true)
= link_to "#{t 'layouts.application.menu.randomq'}", random_questions_path(:unanswered => true)
%li
= link_to "Badges", badges_path
= link_to "#{t 'layouts.application.menu.badges'}", badges_path
%li
= link_to "Pages", pages_path
= link_to "#{t 'layouts.application.menu.pages'}", pages_path

=render "widgets/tag_cloud", :widget => TagCloudWidget.new

.widget-networks.module
%h3 Siguenos y comparte:
%h3= t 'layouts.application.follow'
%ul
%li
=link_to "Facebook", "#", :class => "facebook", :rel => "nofollow"
Expand All @@ -91,10 +91,6 @@
=image_tag "atom.png", :width => 20
.clear

.add
%h6 Publicidad
=link_to image_tag "http://www.bipbanners.co.uk/assets/images/WebConveyancing_Animated_SkyScraper_Banner_Sample_1A.gif"

%section.content-panel
- unless params[:controller] =~ /moderate\//
//= render "shared/action-tabs"
Expand All @@ -108,9 +104,6 @@

%section.right-panel

.add
%h6 Publicidad
=link_to image_tag "banner-250x250.jpg"

= yield :sidebar

Expand Down
2 changes: 1 addition & 1 deletion app/views/questions/_attachments.html.haml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-attachments.each_file do |key, file|
#attachments_list
.header Attached files:
.header #{t 'question.attachment.attached'}:
%ul
%li
= link_to file.name, question_attachment_path(question.group, question, file, key)
Expand Down
8 changes: 5 additions & 3 deletions app/views/questions/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

=render "followup_form.html.haml", local_assigns

%h1 #{t 'questions.form.name'}

-if @question.position
= hidden_field_tag "question[position][lat]", @question.position["lat"], :class => "lat_input"
= hidden_field_tag "question[position][long]", @question.position["long"], :class => "long_input"
Expand All @@ -16,7 +18,7 @@
%label
=t(".related_questions", :default => :"questions.show.related_questions" )
%ul#related_questions
%small Here you will find questions that are similar to yours
%small #{t 'questions.form.similar'}

.field
= f.label :tags, "#{t(:tags, :scope => "activerecord.attributes.question")}", :class => "label"
Expand All @@ -35,8 +37,8 @@
#fields
.attachment_field.template
= f.file_field "attachments[0]"
= link_to "Remove", "#", :class => "remove_attachment" #i18n
= link_to "Add attachment", "#", :class => "add_attachment" #i18n
= link_to "#{t 'questions.attachment.remove'}", "#", :class => "remove_attachment"
= link_to "#{t 'questions.attachment.add'}", "#", :class => "add_attachment"


-if current_group.languages.size>1 && AppConfig.enable_i18n
Expand Down
10 changes: 5 additions & 5 deletions app/views/questions/_question.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
-if owner
=render :partial => "users/user_data", :locals => {:user => owner}
-else
Por:
#{t 'questions.question.from'}
=t("global.anonymous")
%time{:pubdate => "pubdate", :datetime => last_target_date.iso8601}
= link_to t("time.ago", :time => time_ago_in_words(last_target_date)), question_path(question, :anchor => last_target_id)
Expand All @@ -34,7 +34,7 @@
-if question.tags.empty? && logged_in? && (current_user.can_modify?(@question) || current_user.can_retag_others_questions_on?(current_group))
%ul
%li
Tags:
#{t 'questions.tags.title'}
-question.first_tags.each do |tag|
%li{:class => "tag_#{h(tag)}"}
= tag_link(tag)
Expand All @@ -49,7 +49,7 @@

-if question.followers_count.to_i > 0
%li.followers
= "#{format_number(question.followers_count)} followers"
= "#{format_number(question.followers_count)} #{t '.followers'}"

%li.votes
-unless question.closed
Expand All @@ -70,10 +70,10 @@

%li
-if !logged_in? || !question.follower?(current_user)
=link_to "Seguir", follow_question_path(question)
=link_to "#{t '.continue'}", follow_question_path(question)

%li
=link_to "Responder", question_path(question, :anchor => "to_answer")
=link_to "#{t '.answer'}", question_path(question, :anchor => "to_answer")

.clear

Expand Down
2 changes: 1 addition & 1 deletion app/views/questions/_reward_info.html.haml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-if @question.reward.present? && @question.reward.active
This question has an open reward worth
#{t 'questions.reward.open'}
= "+#{@question.reward.reputation}"
reputation from
= link_to @question.reward.created_by.name, user_path(@question.reward.created_by)
Expand Down
4 changes: 2 additions & 2 deletions app/views/questions/new.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
= t(".how_to_ask")
= raw(current_group.question_help)
%h1
Asking new question
#{t '.head'}
//i18n
%p.description
Please be descriptive with your question, an be sure your are adding good tags for the searchers
#{t '.descr'}
//i18n

- form_for(@question, :html=>{:class => "question-form", :id => "ask_question", :multipart => true}) do |f|
Expand Down
Loading