-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '364-supporters-page' into development
- Loading branch information
Showing
11 changed files
with
148 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
(function() { | ||
var initChangeImageColor = function() { | ||
var elements = document.querySelectorAll('.pk-js-changed-color-images'); | ||
|
||
for(var i = 0; i < elements.length; i++) { | ||
var elem = elements[i]; | ||
processElement(elem); | ||
} | ||
|
||
function processElement(elem) { | ||
var imgNode = elem.childNodes[0]; | ||
var canvas = document.createElement('canvas'); | ||
var imgObj = new Image(); | ||
imgObj.onload = function() { | ||
canvas.width = imgObj.width; | ||
canvas.height = imgObj.height; | ||
|
||
x = canvas.getContext('2d'); | ||
|
||
x.drawImage(imgObj, 0, 0); | ||
|
||
var img = x.getImageData(0, 0, canvas.width, canvas.height); | ||
var pix = img.data; | ||
var n = pix.length; | ||
|
||
for (i = 0; i < n; i += 4) { | ||
if (pix[i + 3] > 0) { | ||
pix[i] = 255; | ||
pix[i + 1] = 244; | ||
pix[i + 2] = 218; | ||
} | ||
} | ||
|
||
x.putImageData(img, 0, 0); | ||
|
||
elem.appendChild(canvas); | ||
} | ||
imgObj.src = imgNode.src; | ||
} | ||
} | ||
|
||
window.initChangeImageColor = initChangeImageColor; | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
53 changes: 53 additions & 0 deletions
53
app/assets/stylesheets/app/pages/supporters/_supporter.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
$namespace: ".pk-supporter"; | ||
|
||
#{$namespace} { | ||
text-decoration: none; | ||
display: inline-block; | ||
vertical-align: middle; | ||
width: 200px; | ||
height: 112px; | ||
padding: 10px; | ||
position: relative; | ||
overflow: hidden; | ||
margin: 8px 0; | ||
img, canvas { | ||
position: absolute; | ||
left: 50%; | ||
top: 50%; | ||
transform: translate3d(-50%,-50%,0); | ||
width: 100%; | ||
transition: opacity .2s ease-out; | ||
} | ||
|
||
img { | ||
opacity: 0; | ||
} | ||
|
||
canvas { | ||
opacity: 1; | ||
} | ||
|
||
&:hover, &:active, &:focus { | ||
text-decoration: none; | ||
img { | ||
opacity: 1; | ||
} | ||
|
||
canvas { | ||
opacity: 0; | ||
} | ||
} | ||
} | ||
|
||
#{$namespace}--medium { | ||
width: 300px; | ||
height: 170px; | ||
} | ||
|
||
#{$namespace} + #{$namespace} { | ||
margin-left: 40px; | ||
} | ||
|
||
#{$namespace}--medium + #{$namespace}--medium { | ||
margin-left: 56px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
class SupportersController < ApplicationController | ||
helper_method :course_supporters, :meetups_supporters, :inlove_partner | ||
|
||
private | ||
|
||
def friends_groups | ||
@friends_groups ||= Group.friends | ||
end | ||
|
||
def course_supporters | ||
@course_supporters ||= friends_groups | ||
.find_by(name: 'Course') | ||
.friends | ||
.where.not(id: inlove_partner.id) | ||
end | ||
|
||
def meetups_supporters | ||
@meetups_supporters ||= friends_groups | ||
.find_by(name: 'meetups') | ||
.friends | ||
.where.not(id: inlove_partner.id) | ||
end | ||
|
||
def inlove_partner | ||
@inlove_partner ||= Friend.find_by(name: 'OnApp') | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
.pk-container | ||
h2 = 'Friends and supporters of pivorak community:' | ||
- meetups_supporters.each do |meetups_supporter| | ||
= link_to meetups_supporter.link, class: 'pk-supporter pk-supporter--medium pk-js-changed-color-images', target: '_blank' | ||
= image_tag meetups_supporter.logo | ||
|
||
h2 = 'Partners of Ruby Summer School:' | ||
div | ||
= link_to inlove_partner.link, class: 'pk-supporter pk-supporter--medium pk-js-changed-color-images', target: '_blank' | ||
= image_tag inlove_partner.logo | ||
|
||
- course_supporters.each do |course_supporter| | ||
= link_to course_supporter.link, class: 'pk-supporter pk-js-changed-color-images', target: '_blank' | ||
= image_tag course_supporter.logo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters