Browse Source

User page modify

Sotaro KARASAWA 10 years ago
parent
commit
6bbc3ba661
5 changed files with 39 additions and 1 deletions
  1. 14 1
      lib/routes/page.js
  2. 15 0
      lib/views/page.html
  3. 5 0
      lib/views/user_page.html
  4. 4 0
      resource/css/_user.scss
  5. 1 0
      resource/css/crowi.scss

+ 14 - 1
lib/routes/page.js

@@ -14,6 +14,14 @@ module.exports = function(crowi, app) {
     return path;
   }
 
+  function isUserPage(path) {
+    if (path.match(/^\/user\/[^\/]+$/)) {
+      return true;
+    }
+
+    return false;
+  }
+
   // TODO: total とかでちゃんと計算する
   function generatePager(options) {
     var next = null, prev = null,
@@ -75,7 +83,12 @@ module.exports = function(crowi, app) {
 
     Revision.findRevisionList(pageData.path, {}, function(err, tree) {
       var revision = pageData.revision || {};
-      res.render(req.query.presentation ? 'page_presentation' : 'page', {
+      var defaultPageTeamplate = 'page';
+      if (isUserPage(pageData.path)) {
+        defaultPageTeamplate = 'user_page';
+      }
+
+      res.render(req.query.presentation ? 'page_presentation' : defaultPageTeamplate, {
         path: pageData.path,
         revision: revision,
         author: revision.author || false,

+ 15 - 0
lib/views/page.html

@@ -3,6 +3,10 @@
 {% block html_title %}{{ path|path2name }} · {{ path }}{% endblock %}
 
 {% block content_head %}
+
+{% block content_head_before %}
+{% endblock %}
+
 <div class="header-wrap">
   <header id="page-header">
     <p class="stopper"><a href="#" data-affix-disable="#page-header"><i class="fa fa-chevron-up"></i></a></p>
@@ -14,9 +18,17 @@
     <h1 class="title" id="revision-path">{{ path }}</h1>
   </header>
 </div>
+
+{% block content_head_after %}
+{% endblock %}
+
 {% endblock %}
 
 {% block content_main %}
+
+{% block content_main_before %}
+{% endblock %}
+
 <div id="content-main" class="content-main {% if not page %}on-edit{% endif %}"
   data-page-id="{% if page %}{{ page._id.toString() }}{% endif %}"
   data-current-user="{% if user %}{{ user._id.toString() }}{% endif %}"
@@ -181,6 +193,9 @@
   {% endif %}
 </div>
 
+{% block content_main_after %}
+{% endblock %}
+
 {% endblock %}
 
 {% block content_footer %}

+ 5 - 0
lib/views/user_page.html

@@ -1,2 +1,7 @@
 {% extends 'page.html' %}
 
+{% block content_head_before %}
+{% endblock %}
+
+{% block content_main_before %}
+{% endblock %}

+ 4 - 0
resource/css/_user.scss

@@ -0,0 +1,4 @@
+
+.user-page {
+  background: #f0f0f0;
+}

+ 1 - 0
resource/css/crowi.scss

@@ -12,6 +12,7 @@
 @import 'wiki';
 @import 'admin';
 @import 'comment';
+@import 'user';
 
 
 ul {