Просмотр исходного кода

WIP: reconstruct layouts

* like, bookmark button
Yuki Takei 8 лет назад
Родитель
Сommit
ce654ab58d

+ 1 - 16
lib/views/layout-crowi/page.html

@@ -14,22 +14,7 @@
           <h1 class="title flex-item-title" id="revision-path"></h1>
           <h1 class="title flex-item-title" id="revision-path"></h1>
           <div id="revision-url" class="url-line"></div>
           <div id="revision-url" class="url-line"></div>
         </div>
         </div>
-        {% if page %}
-        <div>
-          {% if user %}
-          <button
-              data-csrftoken="{{ csrf() }}"
-              data-liked="{% if page.isLiked(user) %}1{% else %}0{% endif %}"
-              class="like-button btn btn-default btn-outline btn-circle {% if page.isLiked(user) %}active{% endif %}"
-          ><i class="icon-like"></i></button>
-          {% endif %}
-        </div>
-        <div>
-          {% if user %}
-          <span id="bookmark-button"></span>
-          {% endif %}
-        </div>
-        {% endif %}
+        {% include '../widget/header-buttons.html' %}
       </div>
       </div>
     </header>
     </header>
   </div>
   </div>

+ 1 - 16
lib/views/layout-crowi/page_list.html

@@ -36,22 +36,7 @@
         </div>
         </div>
         <div id="revision-url" class="url-line"></div>
         <div id="revision-url" class="url-line"></div>
       </div>
       </div>
-      {% if page %}
-      <div>
-        {% if user %}
-        <button
-            data-csrftoken="{{ csrf() }}"
-            data-liked="{% if page.isLiked(user) %}1{% else %}0{% endif %}"
-            class="like-button btn btn-default btn-outline btn-circle {% if page.isLiked(user) %}active{% endif %}"
-        ><i class="icon-like"></i></button>
-        {% endif %}
-      </div>
-      <div>
-        {% if user %}
-        <span id="bookmark-button"></span>
-        {% endif %}
-      </div>
-      {% endif %}
+      {% include '../widget/header-buttons.html' %}
     </div>
     </div>
 
 
   </header>
   </header>

+ 1 - 14
lib/views/layout-growi/widget/header.html

@@ -11,20 +11,7 @@
         <div id="revision-url" class="url-line"></div>
         <div id="revision-url" class="url-line"></div>
       </div>
       </div>
       {% if page %}
       {% if page %}
-      <div>
-        {% if user %}
-        <button
-            data-csrftoken="{{ csrf() }}"
-            data-liked="{% if page.isLiked(user) %}1{% else %}0{% endif %}"
-            class="like-button btn btn-default btn-outline btn-circle {% if page.isLiked(user) %}active{% endif %}"
-        ><i class="icon-like"></i></button>
-        {% endif %}
-      </div>
-      <div>
-        {% if user %}
-        <span id="bookmark-button"></span>
-        {% endif %}
-      </div>
+      {% include '../../widget/header-buttons.html' %}
 
 
       <ul class="authors hidden-sm hidden-xs">
       <ul class="authors hidden-sm hidden-xs">
         <li>
         <li>

+ 6 - 0
lib/views/widget/header-button-bookmark.html

@@ -0,0 +1,6 @@
+{# This widget will be rendered by React #}
+{% if not size == null %}
+  <span id="bookmark-button-{{size}}"></span>
+{% else %}
+  <span id="bookmark-button"></span>
+{% endif %}

+ 7 - 0
lib/views/widget/header-button-like.html

@@ -0,0 +1,7 @@
+<button
+    data-csrftoken="{{ csrf() }}"
+    data-liked="{% if page.isLiked(user) %}1{% else %}0{% endif %}"
+    class="like-button btn btn-default btn-outline btn-circle
+          {% if not size == null %}btn-{{size}}{% endif %}
+          {% if page.isLiked(user) %}active{% endif %}"
+><i class="icon-like"></i></button>

+ 13 - 0
lib/views/widget/header-buttons-lg.html

@@ -0,0 +1,13 @@
+{% if page %}
+  {% set opts = { size: 'lg' }  %}
+  <div>
+    {% if user %}
+      {% include 'header-button-like.html' with opts %}
+    {% endif %}
+  </div>
+  <div class="m-l-5">
+    {% if user %}
+      {% include 'header-button-bookmark.html' with opts %}
+    {% endif %}
+  </div>
+{% endif %}

+ 12 - 0
lib/views/widget/header-buttons.html

@@ -0,0 +1,12 @@
+{% if page %}
+  <div>
+    {% if user %}
+      {% include 'header-button-like.html' %}
+    {% endif %}
+  </div>
+  <div class="m-l-5">
+    {% if user %}
+      {% include 'header-button-bookmark.html' %}
+    {% endif %}
+  </div>
+{% endif %}

+ 2 - 9
lib/views/widget/user_page_header.html

@@ -21,15 +21,8 @@
           </ul>
           </ul>
         </div>
         </div>
       </div>
       </div>
-      <div>
-        {% if page and user %}
-        <button
-            data-csrftoken="{{ csrf() }}"
-            data-liked="{% if page.isLiked(user) %}1{% else %}0{% endif %}"
-            class="like-button btn btn-lg btn-default btn-outline btn-circle {% if page.isLiked(user) %}active{% endif %}"
-        ><i class="icon-like"></i></button>
-        <span id="bookmark-button-lg"></span>
-        {% endif %}
+      <div class="d-flex">
+        {% include 'header-buttons-lg.html' %}
       </div>
       </div>
     </div>
     </div>
   </header>
   </header>

+ 1 - 1
resource/styles/scss/_page.scss

@@ -37,7 +37,7 @@
       border: none;
       border: none;
       font-size: 1.2em;
       font-size: 1.2em;
       line-height: 0.8em;
       line-height: 0.8em;
-      &:not(:hover) {
+      &:not(:hover):not(.active) {
         background-color: transparent;
         background-color: transparent;
       }
       }
     }
     }

+ 1 - 0
resource/styles/scss/style.scss

@@ -3,6 +3,7 @@
 @import 'vendor';
 @import 'vendor';
 
 
 // import variables
 // import variables
+@import '../agile-admin/inverse/variables';
 @import 'variables';
 @import 'variables';
 
 
 // override react-bootstrap-typeahead styles
 // override react-bootstrap-typeahead styles