Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: penso/heritage
base: e63509a6df
...
head fork: penso/heritage
compare: c00be84c8f
Checking mergeability… Don't worry, you can still create the pull request.
  • 11 commits
  • 31 files changed
  • 0 commit comments
  • 1 contributor
Showing with 220 additions and 25 deletions.
  1. +4 −0 .gitignore
  2. +7 −0 ChangeLog
  3. +1 −0  Gemfile
  4. +3 −0  Gemfile.lock
  5. +25 −0 app/assets/stylesheets/about.css
  6. +1 −1  app/assets/stylesheets/flexslider_overrides.css
  7. +19 −0 app/assets/stylesheets/global.css.erb
  8. +4 −0 app/controllers/application_controller.rb
  9. +0 −3  app/controllers/photographers_controller.rb
  10. +6 −0 app/helpers/application_helper.rb
  11. +10 −0 app/mailers/user_mailer.rb
  12. +5 −0 app/models/user.rb
  13. +1 −1  app/views/accounts/stories.html.erb
  14. +1 −1  app/views/accounts/website.html.erb
  15. +1 −1  app/views/layouts/adminfixed.html.erb
  16. +2 −5 app/views/layouts/story.html.erb
  17. +1 −1  app/views/photographers/show.html.erb
  18. +4 −0 app/views/stories/_thumbnails.html.erb
  19. +18 −3 app/views/stories/show.html.erb
  20. +46 −0 app/views/user_mailer/welcome_email.html.erb
  21. +18 −0 app/views/user_mailer/welcome_email.text.erb
  22. +6 −0 config/environments/production.rb
  23. +2 −0  config/environments/test.rb
  24. +2 −2 config/initializers/devise.rb
  25. +3 −0  config/initializers/rails_config.rb
  26. +5 −0 config/settings.yml
  27. 0  config/settings/development.yml
  28. 0  config/settings/production.yml
  29. 0  config/settings/test.yml
  30. +13 −0 spec/mailers/user_mailer_spec.rb
  31. +12 −7 spec/models/user_spec.rb
View
4 .gitignore
@@ -14,3 +14,7 @@
/log/*.log
/tmp
/public/uploads
+
+config/settings.local.yml
+config/settings/*.local.yml
+config/environments/*.local.yml
View
7 ChangeLog
@@ -1,3 +1,10 @@
+2013-01-20 Fabien Penso <fabien.penso@conovae.com>
+
+ * Title in photographer's front page
+ * Slide counters below photos
+ * Bugfixes
+ * 2h
+
2013-01-08 Fabien Penso <fabien.penso@conovae.com>
* specs fixing, lots of bugfix
View
1  Gemfile
@@ -81,3 +81,4 @@ gem "has_permalink"
gem "lograge"
gem 'gravatar-ultimate'
gem 'redcarpet'
+gem 'rails_config'
View
3  Gemfile.lock
@@ -159,6 +159,8 @@ GEM
activesupport (= 3.2.11)
bundler (~> 1.0)
railties (= 3.2.11)
+ rails_config (0.3.2)
+ activesupport (>= 3.0)
railties (3.2.11)
actionpack (= 3.2.11)
activesupport (= 3.2.11)
@@ -284,6 +286,7 @@ DEPENDENCIES
lograge
mysql2
rails
+ rails_config
rainbow
redcarpet
rmagick
View
25 app/assets/stylesheets/about.css
@@ -10,3 +10,28 @@
width: 800px;
margin: 0px;
}
+.thumbnails_main p {
+ text-align: left;
+ font-family: 'Titillium Web', sans-serif;
+ font-weight: 200;
+ font-size: 110%;
+ color: #7D7D7D;
+ font-style: normal;
+ padding: 0;
+ margin: 0;
+ margin-left: 5px;
+ line-height: 20px;
+}
+.thumbnails_main h3 {
+ font-family: 'Titillium Web', sans-serif;
+ font-weight: 200;
+ font-size: 110%;
+ color: #666;
+ text-align: left;
+ font-style: normal;
+ font-weight: bold;
+ padding: 0;
+ margin: 0;
+ margin-left: 5px;
+ line-height: 30px;
+}
View
2  app/assets/stylesheets/flexslider_overrides.css
@@ -1,5 +1,5 @@
#slider {margin: 0 0 10px!important; overflow: hidden;}
-#carousel {overflow:hidden;}
+#carousel {overflow:hidden; margin-bottom: 10px;}
#carousel li {margin-right: 5px;}
#carousel img {display: block; opacity: .8; cursor: pointer;}
#carousel img:hover {opacity: 1;}
View
19 app/assets/stylesheets/global.css.erb
@@ -192,3 +192,22 @@ a:hover,a:active {
#newsletter_modal p {
line-height: 1.2em;
}
+#photos_counter {
+ font-size: 14px;
+ color: #666;
+}
+#story_description {
+ font-size: 14px;
+ color: #666;
+ padding: 10px;
+}
+#story_description h3 {
+ font-family: 'Titillium Web', sans-serif;
+ font-weight: 200;
+ font-style: normal;
+ font-weight: bold;
+ line-height: 30px;
+ margin: 0;
+ padding: 0;
+ font-size: 18px;
+}
View
4 app/controllers/application_controller.rb
@@ -25,6 +25,10 @@ def set_photographer
:include => [:stories])
end
+ @markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML,
+ :autolink => true,
+ :space_after_headers => true)
+
# use request.host ? raise ActiveRecord::RecordNotFound ?
end
View
3  app/controllers/photographers_controller.rb
@@ -64,9 +64,6 @@ def get_photographer
end
def set_title
- @markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML,
- :autolink => true,
- :space_after_headers => true)
@title ||= @photographer.name if @photographer
end
end
View
6 app/helpers/application_helper.rb
@@ -11,6 +11,12 @@ def full_image_link(url)
request.protocol + request.host_with_port + url
end
+ def user_description_text(user)
+ return unless user.description
+
+ @markdown.render(user.description)
+ end
+
def user_avatar_url(user)
if user.user_avatar && !user.user_avatar.new_record?
user.user_avatar.image_url(:thumb)
View
10 app/mailers/user_mailer.rb
@@ -0,0 +1,10 @@
+class UserMailer < ActionMailer::Base
+ default :from => Settings[:email_from],
+ :reply_to => Settings[:email_reply_to]
+
+ def welcome_email(user)
+ @user = user
+ mail(:to => user.email,
+ :subject => "Welcome to Heritage")
+ end
+end
View
5 app/models/user.rb
@@ -45,6 +45,11 @@ def generate_permalink
generate_permalink!
end
+ after_create :send_welcome
+ def send_welcome
+ UserMailer.welcome_email(self).deliver
+ end
+
# Include default devise modules. Others available are:
# :token_authenticatable, :confirmable,
# :lockable, :timeoutable and :omniauthable
View
2  app/views/accounts/stories.html.erb
@@ -8,7 +8,7 @@
$.ajax({
data: $('#sortable').sortable('serialize'),
type: 'POST',
- url: '<%= sort_photographer_path(current_user.name) %>',
+ url: '<%= sort_photographer_path(current_user.id) %>',
success: function () {
// it worked!
},
View
2  app/views/accounts/website.html.erb
@@ -9,7 +9,7 @@
:input_html => { :class => 'input-xlarge', :type => 'text' } %>
<span class="help-block">
- Want to use your own domain like www.<%= current_user.name.downcase.gsub(' ', '') %>.com?
+ Want to use your own domain like www.<%= current_user.name ? current_user.name.downcase.gsub(' ', '') : 'domain' %>.com?
<ul>
<li>point your DNS to 91.194.60.228</li>
<li>Fill it up here</li>
View
2  app/views/layouts/adminfixed.html.erb
@@ -49,7 +49,7 @@
</li>
<li class="divider"></li>
<% @stories.each do |story| %>
- <li><%= link_to story.title, edit_story_path(story) %></li>
+ <li><%= link_to "#{story.title} (#{story.photos.count})", edit_story_path(story) %></li>
<% end %>
</ul>
View
7 app/views/layouts/story.html.erb
@@ -12,10 +12,7 @@
<title><%= @title ? @title : "Heritage" %></title>
<%= csrf_meta_tags %>
- <!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
- <!--[if lt IE 9]>
- <script src="http://html5shim.googlecode.com/svn/trunk/html5.js" type="text/javascript"></script>
- <![endif]-->
+ <link href='http://fonts.googleapis.com/css?family=Titillium+Web' rel='stylesheet' type='text/css'>
<%= stylesheet_link_tag "application", :media => "all" %>
<%= stylesheet_link_tag "global", :media => "all" %>
@@ -32,7 +29,7 @@
<div id="story_header_container">
<div class="story_header">
<div class="leftlogo">
- <%= link_to @photographer.name, root_url %>
+ <%= link_to @photographer.name || "", root_url %>
</div>
<div class="navlinks">
<ul>
View
2  app/views/photographers/show.html.erb
@@ -3,7 +3,7 @@
<meta property="og:url" content="<%= root_url %>" />
<meta property="og:image" content="<%= full_image_link @photographer.stories.first.photos.first.image_url(:web) %>" />
<meta property="og:title" content="<%= @photographer.name %> - Photography" />
- <meta property="og:description" content="<%= @photographer.description %>" />
+ <meta property="og:description" content="<%= user_description_text(@photographer) %>" />
<meta property="og:site_name" content="<%= @photographer.name %>"/>
<% end %>
<% end %>
View
4 app/views/stories/_thumbnails.html.erb
@@ -5,9 +5,13 @@
<% photo = story.photos.first %>
<li>
+ <h3><%= story.title %></h3>
<%= link_to(image_tag(photo.image_url(:thumb), :width => 180, :height => 180),
story_photo_url(story, photo.permalink || photo.id),
:class => "thumbnail") %>
+ <p>
+ <%# story.description %>
+ </p>
</li>
<% end %>
View
21 app/views/stories/show.html.erb
@@ -9,7 +9,7 @@
<%= content_for :head_script do %>
<script type="text/javascript">
$(document).ready(function() {
- <% if @story.photos.count > 8 %>
+ <% if @story.photos.count > 80 %>
$('#carousel').flexslider({
animation: "slide",
controlNav: false,
@@ -17,17 +17,23 @@
slideshow: false,
itemWidth: 110,
itemMargin: 5,
+ keyboard: false,
asNavFor: '#slider'
});
<% end %>
$('#slider').flexslider({
animation: "slide",
controlNav: true,
+ keyboard: true,
animationLoop: false,
sync: "#carousel",
slideshow: false,
start: function(slider){
$('body').removeClass('loading');
+ $('#photos_counter').html((slider.currentSlide + 1)+'/'+slider.count);
+ },
+ after: function(slider){
+ $('#photos_counter').html((slider.currentSlide + 1)+'/'+slider.count);
}
});
$('#slider img').click(function() {
@@ -58,18 +64,27 @@
</ul>
</div>
- <% if @story.photos.count > 8 %>
+ <% if @story.photos.count > 80 %>
<div id="carousel" class="flexslider">
<ul class="slides">
<% @story.photos.each_with_index do |photo,i| %>
<li>
- <%= image_tag(photo.image_url(:thumb), :width => 300, :height => 300) if photo.image? %>
+ <%= image_tag(photo.image_url(:thumb), :width => 200, :height => 200) if photo.image? %>
</li>
<% end %>
</ul>
</div>
<% end %>
+ <div id="photos_counter">
+ 1/<%= @story.photos.count %>
+ </div>
+
+ <div id="story_description">
+ <h3><%= @story.title %></h3>
+ <%= @story.description %>
+ </div>
+
</div>
</div>
<% end %>
View
46 app/views/user_mailer/welcome_email.html.erb
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
+ </head>
+ <body>
+ <p>Hey,</p>
+
+ <p>
+ You can put your photos online in a few steps:
+ </p>
+
+ <ol>
+ <li>
+ Fill up your name at <%= link_to edit_account_url(:host => Settings[:admin_domain]),
+ edit_account_url(:host => Settings[:admin_domain]) %> just so it looks
+ nicer while visiting your website.
+ </li>
+
+ <li>
+ Create a story at <%= link_to new_story_url(:host => Settings[:admin_domain]),
+ new_story_url(:host => Settings[:admin_domain]) %>, upload photos (you
+ can batch upload using shift)
+ </li>
+
+ <li>
+ Change your website url at
+ <%= link_to website_account_url(:host => Settings[:admin_domain]),
+ website_account_url(:host => Settings[:admin_domain]) %> if you
+ already own a DNS. Right now you'll be able to access your website at
+ <%= link_to @user.specific_url, "http://#{@user.specific_url}" %>
+ </li>
+ </ol>
+
+ <p>
+ Let me know if I can help.
+ </p>
+
+<pre>
+--
+<%= Settings[:admin_name] %>
+<%= root_url(:host => Settings[:admin_domain]) %>
+</pre>
+
+ </body>
+</html>
View
18 app/views/user_mailer/welcome_email.text.erb
@@ -0,0 +1,18 @@
+Hey,
+
+You can put your photos online in a few steps:
+
+1. Fill up your name at <%= edit_account_url(:host => Settings[:admin_domain]) %> just so it looks
+ nicer while visiting your website.
+
+2. Create a story at <%= new_story_url(:host => Settings[:admin_domain]) %>, upload photos (you
+ can batch upload using shift)
+
+3. Change your website url at <%= website_account_url(:host => Settings[:admin_domain]) %> if you
+ already own a DNS. Right now you'll be able to access your website at http://<%= @user.specific_url %>
+
+Let me know if I can help.
+
+--
+<%= Settings[:admin_name] %>
+<%= root_url(:host => Settings[:admin_domain]) %>
View
6 config/environments/production.rb
@@ -65,4 +65,10 @@
# Log the query plan for queries taking more than this (works
# with SQLite, MySQL, and PostgreSQL)
# config.active_record.auto_explain_threshold_in_seconds = 0.5
+ config.action_mailer.default_url_options = { :host => 'admin.heritage.io' }
+ config.action_mailer.delivery_method = :smtp
+ config.action_mailer.smtp_settings = {
+ address: 'localhost',
+ enable_starttls_auto: false
+ }
end
View
2  config/environments/test.rb
@@ -34,4 +34,6 @@
# Print deprecation notices to the stderr
config.active_support.deprecation = :stderr
+
+ config.action_mailer.default_url_options = { :host => 'localhost:3000' }
end
View
4 config/initializers/devise.rb
@@ -4,7 +4,7 @@
# ==> Mailer Configuration
# Configure the e-mail address which will be shown in Devise::Mailer,
# note that it will be overwritten if you use your own mailer class with default "from" parameter.
- config.mailer_sender = "please-change-me-at-config-initializers-devise@example.com"
+ config.mailer_sender = "fabienpenso@heritage.io"
# Configure the class responsible to send e-mails.
# config.mailer = "Devise::Mailer"
@@ -229,4 +229,4 @@
# When using omniauth, Devise cannot automatically set Omniauth path,
# so you need to do it manually. For the users scope, it would be:
# config.omniauth_path_prefix = "/my_engine/users/auth"
-end
+end
View
3  config/initializers/rails_config.rb
@@ -0,0 +1,3 @@
+RailsConfig.setup do |config|
+ config.const_name = "Settings"
+end
View
5 config/settings.yml
@@ -0,0 +1,5 @@
+email_from: fabienpenso@heritage.io
+email_reply_to: fabienpenso@gmail.com
+domain: heritage.io
+admin_domain: admin.heritage.io
+admin_name: Fabien Penso
View
0  config/settings/development.yml
No changes.
View
0  config/settings/production.yml
No changes.
View
0  config/settings/test.yml
No changes.
View
13 spec/mailers/user_mailer_spec.rb
@@ -0,0 +1,13 @@
+require "spec_helper"
+
+describe UserMailer do
+ let(:user) {FactoryGirl.create(:user)}
+ it "should send a welcome email" do
+ email = UserMailer.welcome_email(user).deliver
+ ActionMailer::Base.deliveries.should_not be_empty
+ email.to.count.should == 1
+ email.to.first.should == user.email
+ email.encoded.should =~ /Create a story at/i
+ email.encoded.should =~ /#{Settings[:admin_domain]}/i
+ end
+end
View
19 spec/models/user_spec.rb
@@ -1,17 +1,15 @@
require 'spec_helper'
describe User do
- before(:each) do
- @new_user = FactoryGirl.create(:user, :name => nil)
- end
+ let(:new_user){FactoryGirl.create(:user, :name => nil)}
it "should have nil permalinks" do
- @new_user.permalink.should be_nil
+ new_user.permalink.should be_nil
end
it "should update user with permalink" do
- @new_user.update_attribute(:name, Faker::Name.name)
- @new_user.permalink.should_not be_nil
+ new_user.update_attribute(:name, Faker::Name.name)
+ new_user.permalink.should_not be_nil
end
it "should create user with permalink" do
@@ -20,10 +18,17 @@
end
it "should create user with internal urls" do
- @new_user.internal_url.should_not be_nil
+ new_user.internal_url.should_not be_nil
end
# Because we use name for links in account/stories
it "should create user with names" do
end
+
+ it "should send a welcome once confirmed" do
+ expect{
+ user = FactoryGirl.create(:user, :name => nil)
+ user.confirm!
+ }.to change{ActionMailer::Base.deliveries.count}.by(2)
+ end
end

No commit comments for this range

Something went wrong with that request. Please try again.