Skip to content

Commit

Permalink
Merge branch 'release/0.5.8'
Browse files Browse the repository at this point in the history
* release/0.5.8:
  #367 fix label
  #367 add images to members show
  #367 add tooltips
  #367 view labels if confession exists
  #367 fix position of labels
  #367 fix positions
  #367 update size of icons
  #367 add icons
  #FIX view positions
  • Loading branch information
kalashnikovisme committed Jan 21, 2016
2 parents 9b8dd4a + 466198b commit f50d6d3
Show file tree
Hide file tree
Showing 14 changed files with 149 additions and 7 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ checkedValue = (component, nomination) ->
init_select2 = (component) ->
$(".select2-petition#activity_lines_corporative_confession_member_id").select2 {
ajax: {
#FIXME don't get from admin namespace
url: Routes.api_admin_members_path()
data: (term, page) ->
{
Expand Down
8 changes: 8 additions & 0 deletions app/assets/javascripts/web/welcome.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -258,5 +258,13 @@ $ ->
load_events()
e.preventDefault()
return
return

$(window).on 'load', ->
stick_to_bottom_of_avatar_labels = ->
$labels = $('.labels')
$labels.each ->
top = $('a.info').first().height() - $(this).height() - 35
$(this).css 'top', top
stick_to_bottom_of_avatar_labels()
return
35 changes: 35 additions & 0 deletions app/assets/stylesheets/web/account.scss
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,41 @@
font-family: mic-bold;
font-weight: bold;
}
.honors, .nominated {
width: 100%;
margin-top: 15px;
h2 {
text-align: center;
}
.user-confessions {
width: 100%;
height: 110px;
margin-top: 20px;
.user-confession {
width: 100px;
float: left;
margin-right: 10px;
cursor: pointer;
img {
width: 100%;
background: #ffa911;
&:hover {
background-color: #ffc90B;
}
}
.text {
margin-top: 2px;
font-family: 'mic-bold';
font-size: 25px;
width: 100%;
text-align: center;
}
&:last-child {
margin-right: 0;
}
}
}
}
blockquote.user-motto {
margin-top: 48px;
color: #333;
Expand Down
13 changes: 13 additions & 0 deletions app/assets/stylesheets/web/welcome.scss
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,19 @@ $orange: #f45c10;
.post, .credo {
margin-top: rem-calc(14);
}
.labels {
position: absolute;
left: 0;
li {
margin-left: 5px;
}
.label {
width: 30px;
height: 30px;
padding: 0;
background: transparent;
}
}
}
}
.banner {
Expand Down
17 changes: 17 additions & 0 deletions app/helpers/web/images_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module Web::ImagesHelper
def number_one_image
'organization/activity_lines/corporative/confession/number_one.png'
end

def debut_image
'organization/activity_lines/corporative/confession/debut_of_the_year.png'
end

def number_one_white_image
'organization/activity_lines/corporative/confession/number_one_white.png'
end

def debut_white_image
'organization/activity_lines/corporative/confession/debut_of_the_year_white.png'
end
end
6 changes: 6 additions & 0 deletions app/models/member.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ def has_auth_provider?(provider)
nil
end

def has_confession?(nomination)
confessions.where(nomination: nomination, state: :confirmed).any?
end

include GenderHelper

#FIXME try fix active form
after_save :remove_empty_positions

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
.people
- if number_one_of_the_year.any?
.number_one_name
= image_tag 'organization/activity_lines/corporative/confession/number_one.png'
= image_tag number_one_image
%span
= nomination
%br
Expand All @@ -20,7 +20,7 @@
.people
- if debut_of_the_year.any?
.debut_name
= image_tag 'organization/activity_lines/corporative/confession/debut_of_the_year.png'
= image_tag debut_image
%span
= nomination
%br
Expand Down
23 changes: 23 additions & 0 deletions app/views/web/members/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,29 @@
- if auth
- if attribute_visible?(@attribute_accesses, auth.provider)
= link_to '', profile_url(auth), class: 'icon-vkontakte big-icon blank'
%hr.orange
- if @member.confessions.confirmed.any?
.honors
%h2
= t('.honors_in_mic')
- gender = @member.is_female? ? 'a' : ''
.user-confessions
- @member.confessions.confirmed.each do |confession|
.user-confession.link{ title: t("tooltip.web.members.show.#{confession.nomination}", name: @member.first_name, gender: gender, year: confession.year), data: { tooltip: true, href: article_path(configus.activity_lines.corporative.confession.article_id) } }
= image_tag send("#{confession.nomination}_image")
.text
= confession.year
- if @member.confessions.on_vote.any?
.nominated
%h2
= t('.nominated')
- gender = @member.is_female? ? 'a' : ''
.user-confessions
- @member.confessions.on_vote.each do |confession|
.user-confession.link{ title: t("tooltip.web.members.show.nominated.#{confession.nomination}", name: @member.first_name, gender: gender), data: { tooltip: true, href: activity_lines_corporative_petitions_path } }
= image_tag send("#{confession.nomination}_image")
.text
= confession.year
.small-7.columns
.row
.small-11.push-1
Expand Down
19 changes: 15 additions & 4 deletions app/views/web/welcome/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,28 @@
%a.info
.vertical-center
.name
= member.short_name
-#.post
= member.main_position_title
-#- if member.position_duration
%u
= member.short_name
.post
%u
= member.main_position_title
- if member.position_duration
.duration
= member.position_duration
.credo
= member.motto
.ticket
%span.glyphicon.glyphicon-credit-card
= member.ticket_number
.labels.vertical-center
%ul.inline-list
- [ :debut, :number_one ].each do |nomination|
- if member.has_confession? nomination
%li
%img{ src: "/assets/#{send("#{nomination}_white_image")}",
class: "label #{nomination} has-tip",
title: t("tooltip.web.welcome.index.#{nomination}", name: member.first_name, gender: (member.is_female? ? 'а' : '')),
'data-tooltip' => true, 'aria-haspopup' => true }
- if @banner
.banner
= link_to @banner.link, class: 'blank' do
Expand Down
16 changes: 16 additions & 0 deletions config/locales/ru/ru.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ ru:
learn_or_work: 'Учусь/Работаю'
live: 'Живу'
ticket: 'Членский билет'
honors_in_mic: Достижения в МИЦ
nominated: Номинирован
corporative:
petitions:
new:
Expand Down Expand Up @@ -220,3 +222,17 @@ ru:
javascript:
flash:
petition_updated: Ходатайство обновлено
tooltip:
web:
welcome:
index:
debut: '%{name} получил%{gender} корпоративную премию «Признание» в номинации «Дебют года»'
number_one: '%{name} получил%{gender} корпоративную премию «Признание» в номинации «Номер один»'
members:
show:
debut: '%{name} получил%{gender} корпоративную премию «Признание» в номинации «Дебют года» в %{year} году. Кликните, чтобы подробнее почитать о премии «Признание».'
number_one: '%{name} получил%{gender} корпоративную премию «Признание» в номинации «Номер один» в %{year} году. Кликните, чтобы подробнее почитать о премии «Признание».'
nominated:
debut: '%{name} номинирован%{gender} на корпоративную премию «Признание» в номинации «Дебют года» в этом году. Кликните, чтобы подробнее почитать о премии «Признание» и поддержать кандидата.'
number_one: '%{name} номинирован%{gender} на корпоративную премию «Признание» в номинации «Номер один» в этом году. Кликните, чтобы подробнее почитать о премии «Признание» и поддержать кандидата.'

3 changes: 2 additions & 1 deletion lib/concerns/avatar_managment.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module AvatarManagment
def default_avatar(target = false)
sex = SexDetector.detector.detect first_name
@sex_detector ||= SexDetector.detector
sex = @sex_detector.detect first_name
image_url = ''
if type == 'Member'
if sex == 'M'
Expand Down
11 changes: 11 additions & 0 deletions lib/concerns/gender_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module GenderHelper
def is_male?
@sex_detector ||= SexDetector.detector
@sex_detector.detect(first_name) == 'M'
end

def is_female?
@sex_detector ||= SexDetector.detector
@sex_detector.detect(first_name) == 'F'
end
end

0 comments on commit f50d6d3

Please sign in to comment.