Skip to content

Instantly share code, notes, and snippets.

@davinmsu
Created April 25, 2014 10:28
Show Gist options
  • Select an option

  • Save davinmsu/11284832 to your computer and use it in GitHub Desktop.

Select an option

Save davinmsu/11284832 to your computer and use it in GitHub Desktop.
h1 Мой блог
.posts
.post
time.teaser
/todo пофиксить на publish_date
p.date = @post.created_at.strftime('%d')
p.month = @post.created_at.strftime('%b')
= image_tag(@post.photos.first.content.url(:blog_index), class: 'teaser') unless @post.photos.empty?
h1 style="#{(@post.photos.empty?)? 'margin-left: 0px;' : ''}"
= link_to @post.title, user_post_path(user_id: @post.user_id, id: @post.id)
time
= link_to ' ', '#', class: 'edit', data: {modal: "#modal.new_entry"}
/todo сделать удаление в модальном окне
/= link_to('[×]', destroy_post_path(@post), style: 'position: absolute; width: 16px; height: 16px;top: 20px;right: 36px;}', method: :delete, data: {confirm: 'Вы уверены что хотите удалить пост?'}) if user_is_admin? or current_user.posts.include?(@post)
.content
= sanitize @post.content, tags: %w(p)
.clearfix
.clearfix
.addons
- @post.photos.each_with_index do |photo, index|
.album
= link_to image_tag(photo.content.url(:thumb)), '', data: {modal: ".photos_modal.ph#{photo.id}" }
- content_for :photos_modal do
div class="modal content photos_modal ph#{photo.id}" style="display: none"
a.close href="#" ×
.content
= (photo.liked_by? current_user)? unlike_link_for(photo) : like_link_for(photo)
= content_tag :div, photo.like_count, class: 'liked', data: {post: photo.id}
- unless photo.previous.nil?
a.prev data-modal=".photos_modal.ph#{photo.previous.id}"
- unless photo.next.nil?
a.next data-modal=".photos_modal.ph#{photo.next.id}"
= link_to image_tag(photo.content.url, class: 'person'), '#', data: {modal: ".photos_modal.ph#{photo.next.id unless photo.next.nil?}" } unless index == @post.photos.size - 1
= link_to image_tag(photo.content.url, class: 'person'), '#', class: 'closeModal' if index == @post.photos.size - 1
/= photo.comments.with_state([:draft, :published]).first.id
= render(partial: '/web/shared/comments/tree', locals: { commentable: photo, comments_tree: photo.comments })
.addons
- @post.videos.each do |video|
.video
a href="#"
h2 #{video.title}
= raw video.content
/todo нужны вообще лайки?
= (video.liked_by? current_user)? unlike_link_for(video) : like_link_for(video)
= content_tag :div, video.like_count, class: 'likes', data: {post: video.id}
= count_link_for(@post)
= (@post.liked_by? current_user)? unlike_link_for(@post) : like_link_for(@post)
/= render(partial: '/web/shared/the_comments/tree', locals: { commentable: @post, comments_tree: @comments })
= render(partial: '/web/shared/comments/tree', locals: { commentable: @post, comments_tree: @comments })
= yield :photos_modal
#modal.modal.content.new_entry style="display: none;"
a.close href="#" ×
= form_for [current_user, @post], html: { multipart: true } do |f|
h1 редактирование поста
/.row
/ select.custom
/ option Запись в блоге
/ option Запись в блоге
/ option Запись в блоге
/.row
/ span Альбом
/ select.custom style="width: 200px;"
/ option Котики
/ option Котики
/ option Котики
/ a.addAlbum href="#" Добавить новый
.row
input#offerNew type="checkbox"
label for="offerNew" предложить как новость для главной
.row
/span Заголовок
= f.text_field :title, placeholder: 'заголовок'
.row
span содержание
= f.text_area :content , placeholder: 'содержание', class: 'autosize'
.row
= image_tag(@post.photos.first.content.url(:thumb), alt: @post.title) unless @post.photos.empty?
.row.imageThumbs
- @post.photos.each do |photo|
= link_to(image_tag(photo.content.url(:small_avatar), alt: @post.title), '#')
.row
button class="add file" type="submit" Готово
.row
= button_to "удалить пост", destroy_post_path(@post), :method=>:delete, class: 'buttonLike', onclick: "return confirm('Вы уверены что хотите удалить пост?')"
.row
button.add.file
|Загрузить файл
= file_field_tag 'Post_photos_content', multiple: true, name: 'post[photos_attributes][][content]', class: 'fileClick'
.row
= f.fields_for :videos do |video_form|
= render 'video_fields', :f => video_form
.row
.links
= link_to_add_association 'Прикрепить видео', f, :videos, id: 'add_fields'
.row
button type="submit" class="add file" Готово
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment