-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy path_index_main.html.erb
80 lines (75 loc) · 3.91 KB
/
_index_main.html.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<% if can? :new, @promotions %>
<div class="offset-md-9" style="margin-top: 50px;margin-bottom: 50px;">
<%= link_to '새 혜택 추가', new_promotion_path, class: "btn btn-sm btn-primary" %>
</div>
<% end %>
<div class="container">
<div class="row">
<% @promotions.uniq.each do |x| %>
<div class="col-md-4" style="margin-top: 30px">
<%= link_to "javascript:void(0)" do %>
<div class="image" data-toggle="modal" data-target="#exampleModal-<%= x.id %>">
<img style="width: 250px; padding: 20px;" src="<%= asset_path "main_logo/mini_#{x.thumb}.png" %>">
<div class="text">
<%= x.title %>
</div>
</div>
<% end %>
</div>
<% end %>
</div>
</div>
<% @promotions.uniq.each do |x| %>
<!-- Modal -->
<div class="modal fade" id="exampleModal-<%= x.id %>" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header" style="justify-content: center;">
<img style="width: 250px" src="<%= asset_path "main_logo/mini_#{x.thumb}.png" %>">
<button type="button" class="close" data-dismiss="modal" aria-label="Close" style="position: fixed; margin: -20px 14rem;">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div style="float: right;">
<% if not (user_signed_in?) %>
<small>좋아요 투표는 로그인 후 가능합니다.<br/></small>
<% else %>
<% if ((current_user.voted_up_on? x) == true) %>
<%= render 'promotions/vote_render/vote_up', x: x %>
<% else %>
<%= render 'promotions/vote_render/vote_cancel', x: x %>
<% end %>
<span style="color: gray"><span class="like_count-<%= x.id %>"><%= x.get_upvotes.size %></span> 명이 좋아합니다!</span>
<% end %>
</div>
<div style="font-size: 25px; margin-top: 20px; font-weight: bold; color: #9a9a9a"><%= x.title %></div>
<% if not (user_signed_in?) %>
<span style="color: gray"><span class="like_count-<%= x.id %>"><%= x.get_upvotes.size %></span> 명이 좋아합니다!</span>
<% end %>
<div style="font-size: 15px; margin-top: 20px;"><%= x.content %></div>
<div style="font-size: 15px; margin-top: 20px;"><%= render_with_hashtags(x.univ_hashtag) %></div>
<div class="offset-md-8 col-md-4">
<% if can? :edit, @promotion %>
<%= link_to "수정", edit_promotion_path(x), class: 'btn btn-sm btn-outline-dark' %>
<% end %>
<% if can? :edit, @promotion %>
<%= link_to "삭제", x, method: :delete, class: 'btn btn-sm btn-danger', data: { confirm: '정말로 삭제하시겠습니까?' } %>
<% end %>
</div>
</div>
<div class="modal-footer">
<% if x.instruct_url != nil %>
<%= link_to " 이용방법", x.instruct_url, target: "_blank", class: "fas fa-chalkboard-teacher instruct_url_link" %>
<% end %>
<%= link_to " 이동", x.url, target: "_blank", class: "fas fa-external-link-alt promotion_link" %>
</div>
</div>
</div>
</div>
<% end %>
<% if can? :new, @promotions %>
<div class="offset-md-9" style="margin-top: 50px;margin-bottom: 50px;">
<%= link_to '새 혜택 추가', new_promotion_path, class: "btn btn-sm btn-primary" %>
</div>
<% end %>