app/Resources/views/group/thread.html.twig line 1

Open in your IDE?
  1. {% extends 'group/layout.html.twig' %}
  2. {% do script(['libs/es-ckeditor/ckeditor.js','libs/jquery-validation.js','app/js/group/index.js']) %}
  3. {% block title %}{{threadMain.title}} - {{ groupinfo.title }} {{ parent() }}{% endblock %}
  4. {% block keywords %}{{groupinfo.title}}{% endblock %}
  5. {% block description %}{{threadMainContent|plain_text(100)}}{% endblock %}
  6. {% block group_main %}
  7.   {% include 'common/anti-brush-captcha.html.twig' %}
  8.   
  9.   <div class="panel panel-default">
  10.     <div class="panel-heading">
  11.       <h3 class="panel-title">
  12.         {{ threadMain.title }}
  13.         {% if threadMain.isStick %}
  14.           <span class="label label-primary">{{'group.thread.stick_label'|trans}}</span>
  15.         {% endif %}
  16.         {% if threadMain.isElite %}
  17.           <span class="label label-danger">{{'group.thread.essence_label'|trans}}</span>
  18.         {% endif %}
  19.         {% if is_feature_enabled('group_reward') %}
  20.           {% if threadMain.type == 'reward' and threadMain.rewardCoin > 0 %}
  21.             <span class="label label-danger">{{'group.thread.reward_label'|trans}}</span>
  22.             <span style="color:#d9534f;" class="mll"> {{'group.thread.wanted'|trans({'%rewardCoin%':threadMain.rewardCoin,'%coin_name%':setting('coin').coin_name})}}</span>
  23.           {% endif %}
  24.         {% endif %}
  25.       </h3>
  26.     </div>
  27.     <div class="panel-body clearfix" id="post-action">
  28.       <div class="well well-sm text-sm color-gray clearfix" style="line-height:20px">
  29.         <div class="es-share dropdown pull-right js-es-share">
  30.           <span class="es-share top" style="font-size:14px;">
  31.             <a href="javascript:;" class="gray-dark" data-toggle="dropdown"><i class="es-icon es-icon-share"></i> {{'group.thread.share_label'|trans}}</a>
  32.             {% include 'common/share-dropdown.html.twig' with {type:'group_thread', thread:threadMain, group:groupinfo} %}
  33.           </span>
  34.         </div>
  35.         <div class="pull-right mrm" id="thread-list">
  36.           {% if threadMain.userId != user.id %}
  37.             <a href="javascript:;" class="uncollect-btn link-dark" data-target-type="thread" data-target-id="{{ threadMain.id }}" {% if isCollected == false %} style="display:none;"{% endif %}><i class="es-icon es-icon-favorite mrs"></i> {{'group.thread.favorited_btn'|trans}}</a>
  38.             <a href="javascript:;" class="collect-btn link-dark" data-target-type="thread" data-target-id="{{ threadMain.id }}" {% if isCollected == true %} style="display:none;"{% endif %}><i class="es-icon es-icon-favoriteoutline mrs"></i>{{'group.thread.favorite_btn'|trans}}</a>
  39.           {% endif %}
  40.         </div>
  41.         {{'group.thread.created_time'|trans({'%createdTime%':threadMain.createdTime|smart_time})}}
  42.         <span class="mll"> {{'group.thread.hit_num'|trans({'%hitNum%':threadMain.hitNum})}}</span>
  43.         <span style="color: red;" id="{{ 'js-group-thread-after-' ~ threadMain.id }}"></span>
  44.         {% if app.user.isLogin()|default(false) and app.user.id != threadMain.userId and is_reported('group_thread', threadMain.id)  %}
  45.           <span style="color: red;">({{ '已举报'|trans }})</span>
  46.         {% endif %}
  47.       </div>
  48.       <div class="editor-text">
  49.         {{threadMain.content|cdn|raw}}
  50.       </div>
  51.       {% include 'attachment/widget/list.html.twig' with {targetType:'group.thread', targetId:threadMain.id} %}
  52.       <div class="mtl text-right">
  53.         {% if app.user.isLogin()|default(false) and app.user.id != threadMain.userId and not is_reported('group_thread', threadMain.id) %}
  54.           <a class="btn btn-default btn-sm mrm" id="{{ 'js-group-thread-modal-'~ threadMain.id }}" href="javascript:" data-toggle="modal" data-target="#modal" data-urL="{{ path('common_report_tags_modal', {targetType: 'group_thread', targetId: threadMain.id, modalTarget: 'js-group-thread-modal-'~ threadMain.id, contentTarget: 'js-group-thread-after-' ~ threadMain.id }) }}">{{'举报'|trans}}</a>
  55.         {% endif %}
  56.         {% if is_feature_enabled('group_reward') and threadMain.count == 1 %}
  57.           {% if user.id==owner.id or is_granted('ROLE_ADMIN') or user.id==groupinfo.ownerId or is_groupmember==3 %}
  58.           {% else %}
  59.             {% if app.user %}
  60.             <a class="btn btn-default btn-sm mrm" href="javascript:" data-toggle="modal" data-target="#modal" data-urL="{{path('group_thread_hide',{threadId:threadMain.id})}}">{{'group.thread.check_hide_content'|trans}}</a>
  61.             {% endif %}
  62.           {% endif %}
  63.         {% endif %}
  64.         {% if user.id==owner.id or is_granted('ROLE_ADMIN') or user.id==groupinfo.ownerId or is_groupmember==3 %}
  65.           <a class="btn btn-default btn-sm mrm" href="{{path('group_thread_update',{id:groupinfo.id,threadId:threadMain.id})}}"> {{'thread.edit_btn'|trans}}</a>
  66.         {% endif %}
  67.         {% if is_groupmember==2 or is_granted('ROLE_ADMIN') or is_groupmember==3 %}
  68.           {% if threadMain.isElite==1 %}
  69.             <a id="elite"  title="{{'thread.cancel_essence_btn'|trans}}" class="btn btn-default btn-sm mrm"
  70.               href="javascript:"
  71.             data-url="{{path('group_thread_removeElite',{threadId:threadMain.id})}}">{{'thread.cancel_essence_btn'|trans}}</a>
  72.           {% else %}
  73.             <a id="elite"  title="{{'thread.set_essence_btn'|trans}}" class="btn btn-default btn-sm mrm"
  74.             href="javascript:" data-url="{{path('group_thread_setElite',{threadId:threadMain.id})}}">{{'thread.set_essence_btn'|trans}}</a>
  75.           {% endif %}
  76.           {% if threadMain.isStick==1 %}
  77.              <a id="stick" title="{{'thread.stick_cancel_btn'|trans}}" class="btn btn-default btn-sm mrm"
  78.             href="javascript:" data-url="{{path('group_thread_removeStick',{threadId:threadMain.id})}}"> {{'thread.stick_cancel_btn'|trans}}</a>
  79.           {% else %}
  80.             <a id="stick"  title="{{'thread.stick_btn'|trans}}" class="btn btn-default btn-sm mrm"
  81.             href="javascript:" data-url="{{path('group_thread_setStick',{threadId:threadMain.id})}}">{{'thread.stick_btn'|trans}}</a>
  82.           {% endif %}
  83.         {% endif %}
  84.         {% if filters.type=='onlyOwner' %}
  85.           <a class="btn btn-default btn-sm mrm" href="{{path('group_thread_show',{id:groupinfo.id,threadId:threadMain.id,type:'all',sort:filters.sort})}}" %}><span class="glyphicon glyphicon-filter"></span> {{'group.thread.view_all_btn'|trans}}</a>
  86.         {% else %}
  87.           <a class="btn btn-default btn-sm mrm" href="{{path('group_thread_show',{id:groupinfo.id,threadId:threadMain.id,type:'onlyOwner',sort:filters.sort})}}">{{'group.thread.view_owner_btn'|trans}}</a>
  88.         {% endif %}
  89.         {% if filters.sort=='desc' %}
  90.           <a type="button" class="btn btn-default btn-sm mrm" href="{{path('group_thread_show',{id:groupinfo.id,threadId:threadMain.id,type:filters.type,sort:'asc'})}}">{{'group.thread.asc_see_btn'|trans}}</a>
  91.         {% else %}
  92.           <a type="button" class="btn btn-default btn-sm mrm" href="{{path('group_thread_show',{id:groupinfo.id,threadId:threadMain.id,type:filters.type,sort:'desc'})}}">{{'group.thread.desc_see_btn'|trans}}</a>
  93.         {% endif %}
  94.       </div>
  95.     </div>
  96.   </div>
  97.   {% if threadMain.postNum %}
  98.   <div class="panel panel-default group-post-list">
  99.     <div class="panel-heading">
  100.       {{'group.thread.reply_numbers'|trans({'%postNum%': threadMain.postNum})}}
  101.     </div>
  102.     <div class="panel-body">
  103.       <ul class="media-list">
  104.         {% for post in post %}
  105.           {% set subPosts = postReply[post.id]|default(null) %}
  106.           {% set isOpenInfo = data('StudentOpenInfo', {'userId': post.userId}) %}
  107.           <li id="post-{{post.id}}" class="media main_hover_item">
  108.             <a {% if isOpenInfo == 1 %}href="{{ user_show_path({id:post.userId}) }}"{% endif %} class="pull-left"><img src="{{ filepath(postMember[post.userId].smallAvatar, 'avatar.png') }}" class="avatar-sm"></a>
  109.             <div class="media-body">
  110.               <div class="metas">
  111.                 <span class="floor">
  112.                   {% if filters.sort=='desc' %}
  113.                     {{'group.thread.desc_floor'|trans({'%postCount%':(postCount+1)-paginator.getPerPageCount()*(paginator.currentPage-1)-loop.index0})}}
  114.                   {% else %}
  115.                     {{'group.thread.asc_floor'|trans({'%loop.index%':(loop.index+1)+paginator.getPerPageCount()*(paginator.currentPage-1)})}}
  116.                   {% endif %}
  117.                 </span>
  118.                 <strong>{{ web_macro.user_link(postMember[post.userId]) }}</strong>
  119.                 <span class="divider mhm">•</span>
  120.                 <span >{{post.createdTime|smart_time}} </span>
  121.                 <span id="{{ 'js-group-thread-reply-after-' ~ post.id }}" style="color: red;"></span>
  122.                 {% if app.user.isLogin()|default(false) and app.user.id != post.userId and is_reported('group_thread_reply', post.id)  %}
  123.                   <span style="color: red;">({{ '已举报'|trans }})</span>
  124.                 {% endif %}
  125.               </div>
  126.               <div class="content editor-text">
  127.                 {{post.content|cdn|raw}}
  128.                   {% include 'attachment/widget/list.html.twig' with {targetType:'group.thread.post', targetId:post.id} %}
  129.               </div>
  130.               <div class="actions">
  131.                 {% if app.user.isLogin()|default(false) and app.user.id != post.userId and not is_reported('group_thread_reply', post.id) %}
  132.                   <a class="item-hover" id="{{ 'js-group-thread-reply-modal-'~ post.id }}" href="javascript:" data-toggle="modal" data-target="#modal" data-urL="{{ path('common_report_tags_modal', {targetType: 'group_thread_reply', targetId: post.id, modalTarget: 'js-group-thread-reply-modal-'~ post.id, contentTarget: 'js-group-thread-reply-after-' ~ post.id }) }}">{{'举报'|trans}}</a>
  133.                 {% endif %}
  134.                 {% if user.id==post.userId or is_granted('ROLE_ADMIN')  or is_groupmember==3  or is_groupmember==2 %}
  135.                   <a title="{{'group.thread.delete_tips'|trans}}" class="mhm post-delete-btn" href="javascript:" data-url="{{path('group_thread_deletePost',{postId:post.id})}}">{{'thread.delete_btn'|trans}}</a>
  136.                 {% endif %}
  137.                 {% if is_feature_enabled('group_reward') %}
  138.                   {% if not isAdopt and threadMain.type == "reward" %}
  139.                     {% if is_granted('ROLE_ADMIN')  or is_groupmember==3  or is_groupmember==2 %}
  140.                       <a title="{{'group.thread.accept_tips'|trans}}" class="mhm post-adopt-btn" href="javascript:" data-url="{{path('group_thread_adopt',{postId:post.id})}}">{{'group.thread.accept_btn'|trans}}</a>
  141.                     {% endif %}
  142.                   {% endif %}
  143.                 {% endif %}
  144.                 {% if not subPosts %}
  145.                   <a href="javascript:" class="reply" id="reply-{{post.id}}"  postId="{{post.id}}" postName="{% if not postMember[post.userId].destroyed|default(0) %}{{postMember[post.userId].nickname}}{% else %}{{ 'user.user_had_destroyed'|trans }}{% endif %}" data-from-user-id-nosub="{{postMember[post.userId].id}}">{{'group.thread.reply_btn'|trans}}</a>
  146.                   <a href="javascript:" class="unreply" id="unreply-{{post.id}}" postId="{{post.id}}" style="display:none;">{{'group.thread.collapse_btn'|trans}}</a>
  147.                 {% else %}
  148.                   <a style="display:none;" href="javascript:" class="reply" id="reply-{{post.id}}"  postId="{{post.id}}" postName="{% if not postMember[post.userId].destroyed|default(0) %}{{postMember[post.userId].nickname}}{% else %}{{ 'user.user_had_destroyed'|trans }}{% endif %}" data-from-user-id-nosub="">{{'group.thread.reply_btn'|trans}}({{postReplyCount[post.id]}})</a>
  149.                   <a href="javascript:" class="unreply" id="unreply-{{post.id}}" postId="{{post.id}}" >{{'group.thread.collapse_btn'|trans}}</a>
  150.                 {% endif %}
  151.               </div>
  152.               <div class="reply-{{post.id}}">
  153.                 {% if subPosts %}
  154.                   {% include 'group/post-reply-list.html.twig' with {posts:subPosts, users:postReplyMembers,postMain:post} %}
  155.                 {% else %}
  156.                   <div class="reply-{{post.id}}" style="display:none;">
  157.                     <form  class="thread-post-reply-form reply-{{post.id}}" method="post"  action="{{path('group_thread_post',{groupId:groupinfo.id,threadId:threadMain.id})}}">
  158.                       <div class="form-group">
  159.                         <label class="control-label hide" for="reply-content-{{post.id}}">{{'group.thread.reply_content'|trans}}</label>
  160.                         <div class="controls">
  161.                         <textarea class="form-control" id="reply-content-{{post.id}}"  name="reply-content-{{post.id}}" data-image-upload-url="{{ path('editor_upload', {token:upload_token('default')}) }}"></textarea>
  162.                       </div>
  163.                       </div>
  164.                       <div id="fromUserIdNoSubDiv"></div>
  165.                       <div class="form-group">
  166.                         <input type="hidden" id="dragCaptchaToken-{{post.id}}" name="_dragCaptchaToken" value="">
  167.                         <button postId="{{post.id}}" class=" btn btn-xs btn-primary pull-right reply-btn" data-loading-text="{{'form.btn.reply.submiting'|trans}}">{{'form.btn.reply'|trans}}</button>
  168.                       </div>
  169.                     </form>
  170.                   </div>
  171.                 {% endif %}
  172.               </div>
  173.             </div>
  174.           </li>
  175.         {% endfor %}
  176.       </ul>
  177.       {{ web_macro.paginator(paginator) }}
  178.     </div>
  179.   </div>
  180.   {% endif %}
  181.   <div class="panel panel-default">
  182.     <div class="panel-heading">{{'group.thread.reply'|trans}}</div>
  183.     <div class="panel-body">
  184.       {% if app.user %}
  185.         <form id="post-thread-form" class="post-thread-form thread-form" method="post" action="{{path('group_thread_post',{groupId:groupinfo.id,threadId:threadMain.id})}}">
  186.           <div class="form-group">
  187.             <label class="control-label hide" for="post_content">{{'group.thread.reply.content_title'|trans}}</label>
  188.             <div class="controls">
  189.               <textarea name="content" value="" rows="10" id="post_content" class="form-control" data-image-upload-url="{{ path('editor_upload', {token:upload_token('default')}) }}" data-image-download-url="{{ path('editor_download', {token:upload_token('default')}) }}"></textarea>
  190.             </div>
  191.           </div>
  192.             <div class="form-group">
  193.                 {{ render(controller('AppBundle:File/Attachment:formFields', {targetType: 'group.thread.post', targetId: thread.id|default(0)}, {'showLabel':false})) }}
  194.             </div>
  195.           <div class="form-group">
  196.             <div class="controls">
  197.             <button id="post-thread-btn" data-loading-text="{{'form.btn.save.submiting'|trans}}"  class="post-thread-btn btn btn-primary pull-right">{{'form.btn.reply'|trans}}</button>
  198.             </div>
  199.           </div>
  200.            {% if is_feature_enabled('group_reward') %}
  201.             <input type="hidden" name="group_reward" id="group_reward">
  202.            {% endif %}
  203.           <input type="hidden" name="_csrf_token" value="{{ csrf_token('site') }}">
  204.           <input type="hidden" name="_dragCaptchaToken" value="">
  205.         </form>
  206.       {% else %}
  207.         <div class="empty">
  208.           {{ 'user.not_login.tips'|trans({'%login%':path('login', {goto:app.request.server.get('REQUEST_URI')}), '%register%': path('register', {goto:app.request.server.get('REQUEST_URI') }) })|raw }}
  209.         </div>
  210.       {% endif %}
  211.     </div>
  212.   </div>
  213.   {% include 'group/upload-modal.html.twig' %}
  214. {% endblock %}
  215. {% block group_side %}
  216.   {% set isOpenInfo = data('StudentOpenInfo', {'userId': owner.id}) %}
  217.   <div class="panel panel-default">
  218.     <div class="panel-heading">{{'group.thread.owner'|trans}}</div>
  219.     <div class="panel-body">
  220.       <div class="media">
  221.         <div class="media-left prm">
  222.           <a class=""  {% if isOpenInfo == 1 %}href="{{ user_show_path({id:owner.id}) }}"{% endif %}>
  223.             <img src="{{ filepath(owner.smallAvatar, 'avatar.png') }}" class="avatar-md">
  224.           </a>
  225.         </div>
  226.         <div class="media-body ptm">
  227.           <div>
  228.             <a class="gray-darker">{{ web_macro.user_link(owner)}}</a>
  229.           </div>
  230.           <span class="text-sm gray-medium">{{ owner.title|default('group.thread.owner.empty'|trans) }}</span>
  231.         </div>
  232.       </div>
  233.     </div>
  234.   </div>
  235.   {% if activeMembers %}
  236.     {% include 'group/active-member-list.html.twig' with {activeMembers:activeMembers} %}
  237.   {% endif %}
  238.   <div class="panel panel-default">
  239.     <div class="panel-heading">{{'group.detail.hot_group'|trans}}</div>
  240.     <div class="panel-body">
  241.       {% set hotGroups = data('HotGroup',{'count':3}) %}
  242.       {% for group in hotGroups %}
  243.         <div class="media media-group">
  244.           <div class="media-left">
  245.             <a href="{{path('group_show',{id:group.id})}}" title="{{group.title}}">
  246.               <img src="{{filepath(group.logo, 'group.png')}}" alt="{{group.title}}" class="avatar-square-md">
  247.             </a>
  248.           </div>
  249.           <div class="media-body">
  250.             <div class="title">
  251.               <a class="gray-darker" href="{{ path('group_show',{id:group.id}) }}" title="{{group.title}}">
  252.                 {{group.title}}
  253.               </a>
  254.             </div>
  255.             <div class="metas">
  256.               <span><i class="es-icon es-icon-people"></i>{{group.memberNum}}</span>
  257.               <span><i class="es-icon es-icon-textsms"></i>{{group.threadNum}}</span>
  258.             </div>
  259.           </div>
  260.         </div>
  261.       {% else %}
  262.         <div class="empty">{{'group.detail.hot_group.empty'|trans}}</div>
  263.       {% endfor %}
  264.     </div>
  265.   </div>
  266. {% endblock %}