github.com/ngocphuongnb/tetua@v0.0.7-alpha/app/themes/default/views/partials/common.jade (about) 1 mixin Messages(msgs) 2 if msgs.Length() > 0 3 ul.messages 4 - var messages = msgs.Get() 5 each msg in messages 6 li(class=msg.Type)=msg.Message 7 8 9 mixin helpCompose() 10 strong(style='margin-bottom:5px;display:block') Writing a Great Post 11 ul 12 li 13 | Using markdown shortcut to compose your post. 14 li 15 | Use the Markdown switch button to toggle between rich text and plain markdown editor mode. 16 li 17 | Select the topics that represent for the post content. 18 19 mixin helpManage() 20 +helpCompose() 21 22 mixin helpDetail() 23 +helpCompose() 24 25 mixin newButton(label, link) 26 a.link-icon(href=link) 27 svg(style='width:24px;height:24px' viewBox='0 0 24 24') 28 path(fill='currentColor' d='M17,13H13V17H11V13H7V11H11V7H13V11H17M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z') 29 =label 30 31 mixin manageMenu() 32 h2.header 33 a(href=utils.Url("/manage")) Manage 34 ul.manage-features 35 li 36 a(href=utils.Url("/manage/topics")) 37 svg(viewBox='0 0 24 24') 38 path(fill='currentColor' d='M9,1H19A2,2 0 0,1 21,3V19L19,18.13V3H7A2,2 0 0,1 9,1M15,20V7H5V20L10,17.82L15,20M15,5C16.11,5 17,5.9 17,7V23L10,20L3,23V7A2,2 0 0,1 5,5H15Z') 39 | Topics 40 li 41 a(href=utils.Url("/manage/posts")) 42 svg(viewBox='0 0 24 24') 43 path(fill='currentColor' d='M20 5L20 19L4 19L4 5H20M20 3H4C2.89 3 2 3.89 2 5V19C2 20.11 2.89 21 4 21H20C21.11 21 22 20.11 22 19V5C22 3.89 21.11 3 20 3M18 15H6V17H18V15M10 7H6V13H10V7M12 9H18V7H12V9M18 11H12V13H18V11Z') 44 | Posts 45 li 46 a(href=utils.Url("/manage/pages")) 47 svg(viewBox='0 0 24 24') 48 path(fill='currentColor' d='M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M18,20H6V4H13V9H18V20Z') 49 | Pages 50 li 51 a(href=utils.Url("/manage/roles")) 52 svg(viewBox='0 0 24 24') 53 path(fill='currentColor' d='M17 14.4C17.6 14.4 18.1 14.9 18.1 15.5S17.6 16.6 17 16.6 15.9 16.1 15.9 15.5 16.4 14.4 17 14.4M17 17.5C16.3 17.5 14.8 17.9 14.8 18.6C15.3 19.3 16.1 19.8 17 19.8S18.7 19.3 19.2 18.6C19.2 17.9 17.7 17.5 17 17.5M18 11.1V6.3L10.5 3L3 6.3V11.2C3 15.7 6.2 20 10.5 21C11.1 20.9 11.6 20.7 12.1 20.5C13.2 22 15 23 17 23C20.3 23 23 20.3 23 17C23 14 20.8 11.6 18 11.1M11 17C11 17.6 11.1 18.1 11.2 18.6C11 18.7 10.7 18.8 10.5 18.9C7.3 17.9 5 14.7 5 11.2V7.6L10.5 5.2L16 7.6V11.1C13.2 11.6 11 14 11 17M17 21C14.8 21 13 19.2 13 17S14.8 13 17 13 21 14.8 21 17 19.2 21 17 21Z') 54 | Roles 55 li 56 a(href=utils.Url("/manage/users")) 57 svg(viewBox='0 0 24 24') 58 path(fill='currentColor' d='M13.07 10.41A5 5 0 0 0 13.07 4.59A3.39 3.39 0 0 1 15 4A3.5 3.5 0 0 1 15 11A3.39 3.39 0 0 1 13.07 10.41M5.5 7.5A3.5 3.5 0 1 1 9 11A3.5 3.5 0 0 1 5.5 7.5M7.5 7.5A1.5 1.5 0 1 0 9 6A1.5 1.5 0 0 0 7.5 7.5M16 17V19H2V17S2 13 9 13 16 17 16 17M14 17C13.86 16.22 12.67 15 9 15S4.07 16.31 4 17M15.95 13A5.32 5.32 0 0 1 18 17V19H22V17S22 13.37 15.94 13Z') 59 | Users 60 li 61 a(href=utils.Url("/manage/comments")) 62 svg(viewBox='0 0 24 24') 63 path(fill='currentColor' d='M20 2H4C2.9 2 2 2.9 2 4V22L6 18H20C21.1 18 22 17.1 22 16V4C22 2.9 21.1 2 20 2M20 16H5.2L4 17.2V4H20V16Z') 64 | Comments 65 li 66 a(href=utils.Url("/manage/files")) 67 svg(viewBox='0 0 24 24') 68 path(fill='currentColor' d='M21,17H7V3H21M21,1H7A2,2 0 0,0 5,3V17A2,2 0 0,0 7,19H21A2,2 0 0,0 23,17V3A2,2 0 0,0 21,1M3,5H1V21A2,2 0 0,0 3,23H19V21H3M15.96,10.29L13.21,13.83L11.25,11.47L8.5,15H19.5L15.96,10.29Z') 69 | Files 70 li 71 a(href=utils.Url("/manage/settings")) 72 svg(viewBox='0 0 24 24') 73 path(fill='currentColor' d='M12,8A4,4 0 0,1 16,12A4,4 0 0,1 12,16A4,4 0 0,1 8,12A4,4 0 0,1 12,8M12,10A2,2 0 0,0 10,12A2,2 0 0,0 12,14A2,2 0 0,0 14,12A2,2 0 0,0 12,10M10,22C9.75,22 9.54,21.82 9.5,21.58L9.13,18.93C8.5,18.68 7.96,18.34 7.44,17.94L4.95,18.95C4.73,19.03 4.46,18.95 4.34,18.73L2.34,15.27C2.21,15.05 2.27,14.78 2.46,14.63L4.57,12.97L4.5,12L4.57,11L2.46,9.37C2.27,9.22 2.21,8.95 2.34,8.73L4.34,5.27C4.46,5.05 4.73,4.96 4.95,5.05L7.44,6.05C7.96,5.66 8.5,5.32 9.13,5.07L9.5,2.42C9.54,2.18 9.75,2 10,2H14C14.25,2 14.46,2.18 14.5,2.42L14.87,5.07C15.5,5.32 16.04,5.66 16.56,6.05L19.05,5.05C19.27,4.96 19.54,5.05 19.66,5.27L21.66,8.73C21.79,8.95 21.73,9.22 21.54,9.37L19.43,11L19.5,12L19.43,13L21.54,14.63C21.73,14.78 21.79,15.05 21.66,15.27L19.66,18.73C19.54,18.95 19.27,19.04 19.05,18.95L16.56,17.95C16.04,18.34 15.5,18.68 14.87,18.93L14.5,21.58C14.46,21.82 14.25,22 14,22H10M11.25,4L10.88,6.61C9.68,6.86 8.62,7.5 7.85,8.39L5.44,7.35L4.69,8.65L6.8,10.2C6.4,11.37 6.4,12.64 6.8,13.8L4.68,15.36L5.43,16.66L7.86,15.62C8.63,16.5 9.68,17.14 10.87,17.38L11.24,20H12.76L13.13,17.39C14.32,17.14 15.37,16.5 16.14,15.62L18.57,16.66L19.32,15.36L17.2,13.81C17.6,12.64 17.6,11.37 17.2,10.2L19.31,8.65L18.56,7.35L16.15,8.39C15.38,7.5 14.32,6.86 13.12,6.62L12.75,4H11.25Z') 74 | Settings 75 76 mixin userMenu() 77 .meta.flex 78 !=meta.User.AvatarElm('32', '32', false) 79 div 80 a.author(href=meta.User.Url())=meta.User.Name() 81 div.stat.flex 82 span="@" + meta.User.Username 83 ul.manage-features 84 li 85 a(href=utils.Url("/posts/new")) 86 svg(style='width:24px;height:24px' viewBox='0 0 24 24') 87 path(fill='currentColor' d='M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M13,7H11V11H7V13H11V17H13V13H17V11H13V7Z') 88 | New post 89 li 90 a(href=utils.Url("/posts")) 91 svg(viewBox='0 0 24 24') 92 path(fill='currentColor' d='M20 5L20 19L4 19L4 5H20M20 3H4C2.89 3 2 3.89 2 5V19C2 20.11 2.89 21 4 21H20C21.11 21 22 20.11 22 19V5C22 3.89 21.11 3 20 3M18 15H6V17H18V15M10 7H6V13H10V7M12 9H18V7H12V9M18 11H12V13H18V11Z') 93 | My Posts 94 li 95 a(href=utils.Url("/comments")) 96 svg(viewBox='0 0 24 24') 97 path(fill='currentColor' d='M20 2H4C2.9 2 2 2.9 2 4V22L6 18H20C21.1 18 22 17.1 22 16V4C22 2.9 21.1 2 20 2M20 16H5.2L4 17.2V4H20V16Z') 98 | My Comments 99 li 100 a(href=utils.Url("/files")) 101 svg(viewBox='0 0 24 24') 102 path(fill='currentColor' d='M21,17H7V3H21M21,1H7A2,2 0 0,0 5,3V17A2,2 0 0,0 7,19H21A2,2 0 0,0 23,17V3A2,2 0 0,0 21,1M3,5H1V21A2,2 0 0,0 3,23H19V21H3M15.96,10.29L13.21,13.83L11.25,11.47L8.5,15H19.5L15.96,10.29Z') 103 | My Files 104 li 105 a(href=utils.Url("/settings")) 106 svg(viewBox='0 0 24 24') 107 path(fill='currentColor' d='M12,8A4,4 0 0,1 16,12A4,4 0 0,1 12,16A4,4 0 0,1 8,12A4,4 0 0,1 12,8M12,10A2,2 0 0,0 10,12A2,2 0 0,0 12,14A2,2 0 0,0 14,12A2,2 0 0,0 12,10M10,22C9.75,22 9.54,21.82 9.5,21.58L9.13,18.93C8.5,18.68 7.96,18.34 7.44,17.94L4.95,18.95C4.73,19.03 4.46,18.95 4.34,18.73L2.34,15.27C2.21,15.05 2.27,14.78 2.46,14.63L4.57,12.97L4.5,12L4.57,11L2.46,9.37C2.27,9.22 2.21,8.95 2.34,8.73L4.34,5.27C4.46,5.05 4.73,4.96 4.95,5.05L7.44,6.05C7.96,5.66 8.5,5.32 9.13,5.07L9.5,2.42C9.54,2.18 9.75,2 10,2H14C14.25,2 14.46,2.18 14.5,2.42L14.87,5.07C15.5,5.32 16.04,5.66 16.56,6.05L19.05,5.05C19.27,4.96 19.54,5.05 19.66,5.27L21.66,8.73C21.79,8.95 21.73,9.22 21.54,9.37L19.43,11L19.5,12L19.43,13L21.54,14.63C21.73,14.78 21.79,15.05 21.66,15.27L19.66,18.73C19.54,18.95 19.27,19.04 19.05,18.95L16.56,17.95C16.04,18.34 15.5,18.68 14.87,18.93L14.5,21.58C14.46,21.82 14.25,22 14,22H10M11.25,4L10.88,6.61C9.68,6.86 8.62,7.5 7.85,8.39L5.44,7.35L4.69,8.65L6.8,10.2C6.4,11.37 6.4,12.64 6.8,13.8L4.68,15.36L5.43,16.66L7.86,15.62C8.63,16.5 9.68,17.14 10.87,17.38L11.24,20H12.76L13.13,17.39C14.32,17.14 15.37,16.5 16.14,15.62L18.57,16.66L19.32,15.36L17.2,13.81C17.6,12.64 17.6,11.37 17.2,10.2L19.31,8.65L18.56,7.35L16.15,8.39C15.38,7.5 14.32,6.86 13.12,6.62L12.75,4H11.25Z') 108 | Settings 109 110 mixin topicSelect(name, topics, current) 111 select(name=name) 112 option(value='') -- 113 each t in topics 114 if t.ID == current.ParentID 115 option(value=t.ID, selected='selected')=t.Name 116 else 117 option(value=t.ID)=t.Name 118 119 mixin topicCheckboxMulti(name, topics, selected) 120 .multi-checkbox.scroll 121 each topic in topics 122 - var inputId = fmt.Sprintf("topic-%d", topic.ID) 123 if utils.SliceContains(selected, topic.ID) 124 label(for=inputId) 125 input(type='checkbox', name=name, value=topic.ID, id=inputId, checked='checked') 126 span.name=topic.Name 127 else 128 label(for=inputId) 129 input(type='checkbox', name=name, value=topic.ID, id=inputId) 130 span.name=topic.Name 131 132 mixin topicSelectMulti(name, topics, selected) 133 details 134 summary Select topics 135 .multi-checkbox.scroll 136 each topic in topics 137 - var inputId = fmt.Sprintf("topic-%d", topic.ID) 138 if utils.SliceContains(selected, topic.ID) 139 label(for=inputId) 140 input(type='checkbox', name=name, value=topic.ID, id=inputId, checked='checked') 141 span.name=topic.Name 142 else 143 label(for=inputId) 144 input(type='checkbox', name=name, value=topic.ID, id=inputId) 145 span.name=topic.Name 146 147 mixin topicSelectSingle(name, topics, selected) 148 select(name=name style="width:140px") 149 option(value='') Select topic 150 each topic in topics 151 if utils.SliceContains(selected, topic.ID) 152 option(value=topic.ID, selected='selected')=topic.Name 153 else 154 option(value=topic.ID)=topic.Name 155 156 mixin formOption(value, selected, label) 157 if value == selected 158 option(value=value selected='')=label 159 else 160 option(value=value)=label 161 162 mixin formInput(name, value, label) 163 p 164 label=label 165 input(name=name value=value) 166 167 mixin formTextarea(name, value, label) 168 p 169 label=label 170 textarea(name=name)=value 171 172 mixin formSwitch(name, condition, label) 173 label.switch 174 =label 175 | 176 if condition 177 input(type='checkbox' name=name checked='checked') 178 else 179 input(type='checkbox' name=name) 180 span.slider 181 182 mixin roleSelectMulti(name, roles, selected) 183 .multi-checkbox.scroll 184 each role in roles 185 - var inputId = fmt.Sprintf("role-%d", role.ID) 186 if utils.SliceContains(selected, role.ID) 187 label(for=inputId) 188 input(type='checkbox', name=name, value=role.ID, id=inputId, checked='checked') 189 span.name=role.Name 190 else 191 label(for=inputId) 192 input(type='checkbox', name=name, value=role.ID, id=inputId) 193 span.name=role.Name 194 195 mixin topicList(topics) 196 div.topics 197 each topic in topics 198 a(href=topic.Url() title=topic.Name)="# "+topic.Name 199 200 201 mixin postMeta(post) 202 .meta.flex 203 !=post.User.AvatarElm('32', '32', false) 204 div 205 a.author(href=post.User.Url() title=post.User.Name())=post.User.Name() 206 div.stat.flex 207 time(datetime=post.CreatedAt.Format("2006-01-02T15:04:05-0700")).date=post.CreatedAt.Format("January 2, 2006") 208 span.views 209 =fmt.Sprintf("%d views", post.ViewCount) 210 span.comment 211 =fmt.Sprintf("%d comments", post.CommentCount) 212 213 mixin postCard(post) 214 - var postUrl = post.Url() 215 - var bgStyle = "" 216 217 if post.FeaturedImage != nil 218 - bgStyle = fmt.Sprintf("background-image:url('%s')", post.FeaturedImage.Url()) 219 article.box 220 a.overlay(href=postUrl title=post.Name)=post.Name 221 if post.FeaturedImage != nil && post.FeaturedImage.ID > 0 222 a.bg(href=postUrl title=post.Name style=bgStyle)=post.Name 223 .box-content 224 +postMeta(post) 225 .info 226 h3 227 a(href=postUrl title=post.Name)=post.Name 228 .tags 229 for topic in post.Topics 230 a(href=topic.Url() title=topic.Name)='#'+topic.Name 231 232 mixin postListItem(post, pos) 233 article 234 h4 235 if pos > 0 236 span.pos=fmt.Sprintf("# %d", pos) 237 a(href=post.Url() title=post.Name)=post.Name 238 .tags 239 for topic in post.Topics 240 a(href=topic.Url() title=topic.Name)='#'+topic.Name 241 242 mixin commentView(comment, postID, editCondition, extraInfo) 243 if extraInfo 244 h4(style='margin:0 0 10px') 245 a(href=comment.Post.Url() target='_blank')=comment.Post.Name 246 .comment.box.flex(id=fmt.Sprintf("comment-%d", comment.ID)) 247 !=comment.User.AvatarElm('30', '30', false) 248 div 249 a.author(href=comment.User.Url())=comment.User.Name() 250 | 251 span.date=comment.CreatedAt.Format("January 2, 2006 15:04 MST") 252 .content 253 !=comment.ContentHTML 254 if editCondition 255 .actions 256 a.edit-comment(href='#', data-id=comment.ID) Edit 257 | 258 a.delete-comment(href='#', data-id=comment.ID) Delete 259 if extraInfo 260 - var commentUrl = fmt.Sprintf("%s#comment-%d", comment.Post.Url(), comment.ID) 261 - var postCommentsUrl = fmt.Sprintf("/manage/comments?post=%d", postID) 262 - var userCommentsUrl = fmt.Sprintf("/manage/comments?user=%d", postID) 263 264 | 265 a.view-comment(href=commentUrl target='_blank') View 266 if meta.User.IsRoot() 267 | 268 a.post-comments(href=postCommentsUrl) All Post comments 269 | 270 a.post-comments(href=userCommentsUrl) All User comments 271 if editCondition 272 form(method="post" action=fmt.Sprintf("/comments/%d", comment.ID)) 273 input(type="hidden" name="post_id" value=postID) 274 textarea(name="content" placeholder="Write your comment here...")=comment.Content 275 button(type="submit") Update