Răsfoiți Sursa

WIP: impl GrantSelector - show the link to /admin/user-groups

Yuki Takei 7 ani în urmă
părinte
comite
d1c68fe0d9

+ 1 - 0
lib/views/layout/layout.html

@@ -118,6 +118,7 @@ gh/highlightjs/cdn-release@9.12.0/build/languages/yaml.min.js
   class="main-container content-wrapper {% block html_base_css %}{% endblock %}
   class="main-container content-wrapper {% block html_base_css %}{% endblock %}
       {% if !layoutType() || 'crowi' === layoutType() %}crowi{% else %}growi{% endif %}"
       {% if !layoutType() || 'crowi' === layoutType() %}crowi{% else %}growi{% endif %}"
   data-me="{{ user._id.toString() }}"
   data-me="{{ user._id.toString() }}"
+  data-is-admin="{{ user.admin }}"
   data-plugin-enabled="{{ isEnabledPlugins() }}"
   data-plugin-enabled="{{ isEnabledPlugins() }}"
   {% block html_base_attr %}{% endblock %}
   {% block html_base_attr %}{% endblock %}
   data-csrftoken="{{ csrf() }}"
   data-csrftoken="{{ csrf() }}"

+ 1 - 0
resource/js/app.js

@@ -63,6 +63,7 @@ const isLoggedin = document.querySelector('.main-container.nologin') == null;
 // FIXME
 // FIXME
 const crowi = new Crowi({
 const crowi = new Crowi({
   me: $('body').data('current-username'),
   me: $('body').data('current-username'),
+  isAdmin: $('body').data('is-admin'),
   csrfToken: $('body').data('csrftoken'),
   csrfToken: $('body').data('csrftoken'),
 }, window);
 }, window);
 window.crowi = crowi;
 window.crowi = crowi;

+ 6 - 1
resource/js/components/PageEditor/GrantSelector.js

@@ -189,7 +189,12 @@ class GrantSelector extends React.Component {
     };
     };
 
 
     let content = this.state.userRelatedGroups.length === 0
     let content = this.state.userRelatedGroups.length === 0
-      ? <span>There is no group to which you belong.</span>
+      ? <div>
+          <p>There is no group to which you belong.</p>
+          { this.props.crowi.isAdmin &&
+            <p><a href="/admin/user-groups"><i className="icon icon-fw icon-login"></i> Manage Groups</a></p>
+          }
+        </div>
       : <ListGroup>
       : <ListGroup>
         {generateGroupListItems()}
         {generateGroupListItems()}
       </ListGroup>;
       </ListGroup>;

+ 1 - 0
resource/js/util/Crowi.js

@@ -35,6 +35,7 @@ export default class Crowi {
 
 
     // FIXME
     // FIXME
     this.me = context.me;
     this.me = context.me;
+    this.isAdmin = context.isAdmin;
 
 
     this.users = [];
     this.users = [];
     this.userByName = {};
     this.userByName = {};