Skip to content

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.
...
  • 9 commits
  • 14 files changed
  • 0 commit comments
  • 1 contributor
View
24 app/assets/javascripts/home.js.coffee
@@ -1,6 +1,7 @@
currentGroup = 0
currentPost = 0
currentUser = 0
+postContentHeight = 0
$('#nav-title-span').live('click', (e) ->
$('#groups-area').toggle()
@@ -21,13 +22,21 @@ $('.post-type')
$.get(url, {}, (html) ->
$('#share-add-ui').html(html)
$('#share-form').dialog('option', 'height', $('#dialog-height').val())
+
$('#post_content').autogrow()
+ postContentHeight = parseInt($('#post_content').css('height'))
$('#post_group_id').selectmenu()
$('#to_groups').tokenInput("/g/search", {theme: "somos", zindex: 2000})
$('#post_content').focus()
)
)
+$('#post_content')
+ .live('resized', () ->
+ grow = parseInt($('#post_content').css('height')) - postContentHeight
+ $('#share-form').dialog('option', 'height', parseInt($('#dialog-height').val()) + grow)
+ )
+
$('#token-everyone span')
.live('click', () ->
$('#token-everyone').hide()
@@ -99,16 +108,22 @@ getComments = (post_id) ->
url = "/posts/#{post_id}/comments/#{$("#post-#{post_id}").attr('last_comment')}"
$.get(url, {}, (html) ->
$(html).appendTo("#post-#{post_id}-comments")
+ $('#posts').masonry('reload')
)
$('.comment-textarea')
.live('click', () ->
$(this).height('48px')
- $('#posts').masonry('reload')
$(this).autogrow()
$("#comment_button_#{$(this).attr('post_id')}").show()
$("#comment-cancel-#{$(this).attr('post_id')}").show()
+ $('#posts').masonry('reload')
+ )
+
+$('.comment-textarea')
+ .live('resized', () ->
+ $('#posts').masonry('reload')
)
$('.comment-form')
@@ -132,6 +147,7 @@ resetCommentArea = (post_id) ->
$("#comment_content_#{post_id}").val('')
$("#comment_button_#{post_id}").hide()
$("#comment-cancel-#{post_id}").hide()
+ $('#posts').masonry('reload')
$('.comment-cancel')
.live("click", () ->
@@ -160,8 +176,10 @@ getRecentPostsCounter = () ->
url = url + 'g/' + currentGroup + '/'
url = url + latestPostId
$.get(url, {}, (html) ->
- $('<div id="new-posts-message"></div>').prependTo("#posts-area") if $('#new-posts-message').length == 0
- $('#new-posts-message').html(html).show() if (html != '0')
+ if $('#new-posts-message').length == 0
+ $('<div id="new-posts-message" class="post"></div>').prependTo("#posts")
+ $('#posts').masonry('reload')
+ $('#new-posts-message').html(html).show() if (parseInt(html) != 0)
)
$('#new-posts-message')
View
3 app/assets/javascripts/jquery.autogrow-textarea.js
@@ -38,7 +38,8 @@
shadow.html(val);
$(this).css('height', Math.max(shadow.height() + 20, minHeight));
-
+ $(this).trigger('resized');
+
}
$(this).change(update).keyup(update).keydown(update);
View
2 app/assets/stylesheets/general.css.scss
@@ -10,7 +10,7 @@
*:first-child+html .clearfix { zoom: 1; }
body {
- background: transparent url(/assets/bg.jpg) center center;
+ background: transparent url(/assets/bg.jpg) center center fixed;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 13px;
font-weight: normal;
View
34 app/assets/stylesheets/post_photos.css.scss
@@ -3,7 +3,39 @@
// You can use Sass (SCSS) here: http://sass-lang.com/
.post-photos {
margin: 0;
+ img {
+ float: left;
+ }
+}
+
+#photos-dnd-area {
+ min-height: 64px;
+ width: 100%;
+ background: #fff;
+ border: 1px dashed $line-color;
+ margin-bottom: 20px;
+}
+
+#dnd-message {
+ text-align: center;
+ margin: 10px 0;
+ color: $grey;
+}
+
+#photos-file-input input[type="file"] {
+ cursor: pointer;
+ height: 64px;
+ position: absolute;
+ right: 0;
+ top: 0;
+ @include opacity(0);
+ font-size: 100px;
+}
+
+#photos-file-list {
img {
- background-color: $line-color;
+ width: 80px;
+ margin: 4px;
+ border: 4px solid $light-grey;
}
}
View
4 app/assets/stylesheets/posts.css.scss
@@ -3,10 +3,6 @@
// You can use Sass (SCSS) here: http://sass-lang.com/
#new-posts-message {
- border: 1px solid $line-color;
- padding: 10px;
- color: $grey;
- margin-top: 10px;
text-align: center;
cursor: pointer;
display: none;
View
3 app/views/layouts/application.html.haml
@@ -5,7 +5,7 @@
= stylesheet_link_tag "application"
= javascript_include_tag "application"
= csrf_meta_tags
- %body
+ %body#body
#topbar
#top-bar-full
#topbar-content
@@ -23,3 +23,4 @@
#container
#flash-notice
= yield
+ .clearfix
View
1 app/views/posts/_post.html.haml
@@ -41,6 +41,7 @@
= image_tag("close.png")
.comment-button{:id => "comment_button_#{post.id}"}
= submit_tag (t :post_comment), :class=> 'post-comment-button', :disable_with => (t :posting_comment)
+ .clearfix
.clearfix
:javascript
$("#post-#{post.id}").attr("last_comment", "#{last_comment}")
View
20 app/views/posts/_view_photo.html.haml
@@ -1,7 +1,21 @@
.post-photos{:id => "gallery-#{post.id}"}
- - post.post_photo.each do |f|
- %a{:href => url_for(:controller => "post_photos", :action => "photo", :id => post.id, :photo_id => f.id, :version => 'large', :filename => File.basename(f.photo.to_s))}
- %img{:src => url_for(:controller => "post_photos", :action => "photo", :id => post.id, :photo_id => f.id, :version => 'small', :filename => File.basename(f.photo.to_s)), :width => '100%'}
+ - c = post.post_photo.count
+ - if c == 1
+ - photo1 = url_for(:controller => "post_photos", :action => "photo", :id => post.id, :photo_id => post.post_photo[0].id, :version => 'small', :filename => File.basename(post.post_photo[0].to_s))
+ %img{:src => photo1, :width => '100%'}
+ - if c == 2
+ - photo1 = url_for(:controller => "post_photos", :action => "photo", :id => post.id, :photo_id => post.post_photo[0].id, :version => 'small', :filename => File.basename(post.post_photo[0].to_s))
+ - photo2 = url_for(:controller => "post_photos", :action => "photo", :id => post.id, :photo_id => post.post_photo[1].id, :version => 'small', :filename => File.basename(post.post_photo[1].to_s))
+ %img{:src => photo1, :width => '50%'}
+ %img{:src => photo2, :width => '50%'}
+ - if c >= 3
+ - photo1 = url_for(:controller => "post_photos", :action => "photo", :id => post.id, :photo_id => post.post_photo[0].id, :version => 'small', :filename => File.basename(post.post_photo[0].to_s))
+ - photo2 = url_for(:controller => "post_photos", :action => "photo", :id => post.id, :photo_id => post.post_photo[1].id, :version => 'small', :filename => File.basename(post.post_photo[1].to_s))
+ - photo3 = url_for(:controller => "post_photos", :action => "photo", :id => post.id, :photo_id => post.post_photo[2].id, :version => 'small', :filename => File.basename(post.post_photo[2].to_s))
+ %img{:src => photo1, :width => '34%'}
+ %img{:src => photo2, :width => '33%'}
+ %img{:src => photo3, :width => '33%'}
+ .clearfix
.post-text
= post.content
View
9 app/views/posts/share_form.html.haml
@@ -22,11 +22,16 @@
- if membership.group.group_type.display_in == GroupType::STREAM
- share_as_options += "<option value=\"#{membership.group.id}\">#{membership.group.name}</option>"
= f.select :group_id, share_as_options.html_safe
+ .clearfix
#share-to
#share-to-label
= t :share_to
#share-to-field
- = text_field_tag :to_groups, :placeholder => "Algo"
-
+ #token-everyone
+ %p= t :everyone
+ %span.token-input-delete-token-somos= "×"
+ #share-tokens
+ = text_field_tag :to_groups
+ .clearfix
#share-button
= submit_tag (t :share), :disable_with => (t :share_wait), :id => "share-submit"
View
12 app/views/posts/ui_file.html.haml
@@ -1,6 +1,8 @@
#share-files
- = hidden_field_tag 'dialog-height', '200'
- %input{:id=>"post_post_file_attributes_file", :multiple=>"multiple", :name=>"post[post_file_attributes][file][]", :type=>"file"}
- %iframe#post-iframe{:width => 0, :height => 0, :scrolling => "no", :frameborder => "0", :name => "post-iframe"}
- :javascript
- $("#new_post").attr("target", "post-iframe");
+ = fields_for @post do |f|
+ = hidden_field_tag 'dialog-height', '340'
+ = f.text_area :content, :placeholder => (t :what_do_you_want_to_share)
+ %input{:id=>"post_post_file_attributes_file", :multiple=>"multiple", :name=>"post[post_file_attributes][file][]", :type=>"file"}
+ %iframe#post-iframe{:width => 0, :height => 0, :scrolling => "no", :frameborder => "0", :name => "post-iframe"}
+ :javascript
+ $("#new_post").attr("target", "post-iframe");
View
3 app/views/posts/ui_link.html.haml
@@ -1,5 +1,6 @@
#share-link
= fields_for @post do |f|
- = hidden_field_tag 'dialog-height', '200'
+ = hidden_field_tag 'dialog-height', '340'
+ = f.text_area :content, :placeholder => (t :what_do_you_want_to_share)
= f.fields_for :post_link do |link_fields|
= link_fields.text_field :link, :placeholder => (t :type_or_paste_link)
View
56 app/views/posts/ui_photo.html.haml
@@ -1,7 +1,53 @@
#share-photos
- = hidden_field_tag 'dialog-height', '200'
- %input{:id=>"post_post_photo_attributes_file", :multiple=>"multiple", :name=>"post[post_photo_attributes][photo][]", :type=>"file"}
- %iframe#post-iframe{:width => 0, :height => 0, :scrolling => "no", :frameborder => "0", :name => "post-iframe"}
- :javascript
- $("#new_post").attr("target", "post-iframe");
+ = fields_for @post do |f|
+ = hidden_field_tag 'dialog-height', '400'
+ #photos-dnd-area
+ #dnd-message= t :attach_images
+ #photos-file-input
+ %input{:id=>"post_post_photo_attributes_file", :multiple=>"multiple", :name=>"post[post_photo_attributes][photo][]", :type=>"file"}
+ #photos-file-list
+ .clearfix
+ .clearfix
+ = f.text_area :content, :placeholder => (t :what_do_you_want_to_share)
+ %iframe#post-iframe{:width => 0, :height => 0, :scrolling => "no", :frameborder => "0", :name => "post-iframe"}
+:javascript
+ $("#new_post").attr("target", "post-iframe");
+ var c = 0;
+ function handleFileSelect(evt) {
+ var f1 = $('#post_post_photo_attributes_file');
+ var f2 = f1.clone(true);
+ f1.attr('id', f1.attr('id') + '-' + c).hide();
+ c++;
+ $('#photos-file-input').append(f2);
+ document.getElementById('post_post_photo_attributes_file').addEventListener('change', handleFileSelect, false);
+
+ var files = evt.target.files; // FileList object
+ // Loop through the FileList and render image files as thumbnails.
+ for (var i = 0, f; f = files[i]; i++) {
+
+ // Only process image files.
+ if (!f.type.match('image.*')) {
+ continue;
+ }
+
+ var reader = new FileReader();
+
+ // Closure to capture the file information.
+ reader.onload = (function(theFile) {
+ return function(e) {
+ // Render thumbnail.
+ var span = document.createElement('span');
+ span.innerHTML = ['<img class="thumb" src="', e.target.result,
+ '" title="', escape(theFile.name), '"/>'].join('');
+ $('#photos-file-list').append(span)
+ };
+ })(f);
+
+ // Read in the image file as a data URL.
+ reader.readAsDataURL(f);
+ }
+ }
+ $(function() {
+ document.getElementById('post_post_photo_attributes_file').addEventListener('change', handleFileSelect, false);
+ });
View
3 config/locales/en.yml
@@ -65,3 +65,6 @@ en:
only_visible_by: "Only visible by:"
lock: "Lock"
everyone: "Everyone"
+
+ attach_images: "Attach images by dragging and dropping them here or choose them manually..."
+ attach_files: "Attach files by dragging and dropping them here or choose them manually..."
View
3 config/locales/es.yml
@@ -217,3 +217,6 @@ es:
only_visible_by: "Solo puede ser visto por:"
lock: "Candado"
everyone: "Todos"
+
+ attach_images: "Adjunta las imagenes arrastrandolas y soltandolas aqui o escogelas manualmente..."
+ attach_files: "Adjunta los archivos arrastrandolos y soltandolos aqui o escogelas manualmente..."

No commit comments for this range

Something went wrong with that request. Please try again.