FEATURE: Swap to raw for topic list (#6)
In order to get access to other topic list status icons (i.e. solved), we must use raw templates.
This commit is contained in:
parent
caa15f3567
commit
895fd41f39
|
@ -1,151 +1,2 @@
|
||||||
require:
|
inherit_gem:
|
||||||
- rubocop-discourse
|
rubocop-discourse: default.yml
|
||||||
|
|
||||||
AllCops:
|
|
||||||
TargetRubyVersion: 2.4
|
|
||||||
DisabledByDefault: true
|
|
||||||
Exclude:
|
|
||||||
- "db/schema.rb"
|
|
||||||
- "bundle/**/*"
|
|
||||||
- "vendor/**/*"
|
|
||||||
- "node_modules/**/*"
|
|
||||||
- "public/**/*"
|
|
||||||
- "plugins/**/gems/**/*"
|
|
||||||
|
|
||||||
# Prefer &&/|| over and/or.
|
|
||||||
Style/AndOr:
|
|
||||||
Enabled: true
|
|
||||||
|
|
||||||
Style/FrozenStringLiteralComment:
|
|
||||||
Enabled: true
|
|
||||||
|
|
||||||
# Do not use braces for hash literals when they are the last argument of a
|
|
||||||
# method call.
|
|
||||||
Style/BracesAroundHashParameters:
|
|
||||||
Enabled: true
|
|
||||||
|
|
||||||
# Align `when` with `case`.
|
|
||||||
Layout/CaseIndentation:
|
|
||||||
Enabled: true
|
|
||||||
|
|
||||||
# Align comments with method definitions.
|
|
||||||
Layout/CommentIndentation:
|
|
||||||
Enabled: true
|
|
||||||
|
|
||||||
# No extra empty lines.
|
|
||||||
Layout/EmptyLines:
|
|
||||||
Enabled: true
|
|
||||||
|
|
||||||
# Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }.
|
|
||||||
Style/HashSyntax:
|
|
||||||
Enabled: true
|
|
||||||
|
|
||||||
# Two spaces, no tabs (for indentation).
|
|
||||||
Layout/IndentationWidth:
|
|
||||||
Enabled: true
|
|
||||||
|
|
||||||
Layout/SpaceAfterColon:
|
|
||||||
Enabled: true
|
|
||||||
|
|
||||||
Layout/SpaceAfterComma:
|
|
||||||
Enabled: true
|
|
||||||
|
|
||||||
Layout/SpaceAroundEqualsInParameterDefault:
|
|
||||||
Enabled: true
|
|
||||||
|
|
||||||
Layout/SpaceAroundKeyword:
|
|
||||||
Enabled: true
|
|
||||||
|
|
||||||
Layout/SpaceAroundOperators:
|
|
||||||
Enabled: true
|
|
||||||
|
|
||||||
Layout/SpaceBeforeFirstArg:
|
|
||||||
Enabled: true
|
|
||||||
|
|
||||||
# Defining a method with parameters needs parentheses.
|
|
||||||
Style/MethodDefParentheses:
|
|
||||||
Enabled: true
|
|
||||||
|
|
||||||
# Use `foo {}` not `foo{}`.
|
|
||||||
Layout/SpaceBeforeBlockBraces:
|
|
||||||
Enabled: true
|
|
||||||
|
|
||||||
# Use `foo { bar }` not `foo {bar}`.
|
|
||||||
Layout/SpaceInsideBlockBraces:
|
|
||||||
Enabled: true
|
|
||||||
|
|
||||||
# Use `{ a: 1 }` not `{a:1}`.
|
|
||||||
Layout/SpaceInsideHashLiteralBraces:
|
|
||||||
Enabled: true
|
|
||||||
|
|
||||||
Layout/SpaceInsideParens:
|
|
||||||
Enabled: true
|
|
||||||
|
|
||||||
# Detect hard tabs, no hard tabs.
|
|
||||||
Layout/Tab:
|
|
||||||
Enabled: true
|
|
||||||
|
|
||||||
# Blank lines should not have any spaces.
|
|
||||||
Layout/TrailingEmptyLines:
|
|
||||||
Enabled: true
|
|
||||||
|
|
||||||
# No trailing whitespace.
|
|
||||||
Layout/TrailingWhitespace:
|
|
||||||
Enabled: true
|
|
||||||
|
|
||||||
Lint/Debugger:
|
|
||||||
Enabled: true
|
|
||||||
|
|
||||||
Layout/BlockAlignment:
|
|
||||||
Enabled: true
|
|
||||||
|
|
||||||
# Align `end` with the matching keyword or starting expression except for
|
|
||||||
# assignments, where it should be aligned with the LHS.
|
|
||||||
Layout/EndAlignment:
|
|
||||||
Enabled: true
|
|
||||||
EnforcedStyleAlignWith: variable
|
|
||||||
|
|
||||||
# Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
|
|
||||||
Lint/RequireParentheses:
|
|
||||||
Enabled: true
|
|
||||||
|
|
||||||
Lint/ShadowingOuterLocalVariable:
|
|
||||||
Enabled: true
|
|
||||||
|
|
||||||
Layout/MultilineMethodCallIndentation:
|
|
||||||
Enabled: true
|
|
||||||
EnforcedStyle: indented
|
|
||||||
|
|
||||||
Layout/HashAlignment:
|
|
||||||
Enabled: true
|
|
||||||
|
|
||||||
Bundler/OrderedGems:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
Style/SingleLineMethods:
|
|
||||||
Enabled: true
|
|
||||||
|
|
||||||
Style/Semicolon:
|
|
||||||
Enabled: true
|
|
||||||
AllowAsExpressionSeparator: true
|
|
||||||
|
|
||||||
Style/RedundantReturn:
|
|
||||||
Enabled: true
|
|
||||||
|
|
||||||
DiscourseCops/NoChdir:
|
|
||||||
Enabled: true
|
|
||||||
Exclude:
|
|
||||||
- 'spec/**/*' # Specs are run sequentially, so chdir can be used
|
|
||||||
- 'plugins/*/spec/**/*'
|
|
||||||
|
|
||||||
DiscourseCops/NoURIEscapeEncode:
|
|
||||||
Enabled: true
|
|
||||||
|
|
||||||
Style/GlobalVars:
|
|
||||||
Enabled: true
|
|
||||||
Severity: warning
|
|
||||||
Exclude:
|
|
||||||
- 'lib/tasks/**/*'
|
|
||||||
- 'script/**/*'
|
|
||||||
- 'spec/**/*.rb'
|
|
||||||
- 'plugins/*/spec/**/*'
|
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
export default Ember.Component.extend({
|
|
||||||
click() {
|
|
||||||
this.selectTopic(this.topic.id);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
|
@ -12,6 +12,20 @@ export default Ember.Component.extend({
|
||||||
return order === "activity";
|
return order === "activity";
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// need to handle clicks here since links are in a raw view
|
||||||
|
didInsertElement() {
|
||||||
|
const topicLinks = this.element.getElementsByClassName(
|
||||||
|
"knowledge-explorer-topic-link"
|
||||||
|
);
|
||||||
|
|
||||||
|
for (let i = 0, max = topicLinks.length; i < max; i++) {
|
||||||
|
topicLinks[i].addEventListener("click", e => {
|
||||||
|
const topicId = e.target.dataset.topicId;
|
||||||
|
this.selectTopic(topicId);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
sortListActivity() {
|
sortListActivity() {
|
||||||
this.sortBy("activity");
|
this.sortBy("activity");
|
||||||
|
|
|
@ -25,13 +25,14 @@ export default {
|
||||||
return data;
|
return data;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
promise = promise.then(data => {
|
promise = promise.then(data => {
|
||||||
data.topics.topic_list.topics = data.topics.topic_list.topics.map(topic => {
|
data.topics.topic_list.topics = data.topics.topic_list.topics.map(
|
||||||
|
topic => {
|
||||||
topic = Topic.create(topic);
|
topic = Topic.create(topic);
|
||||||
return topic;
|
return topic;
|
||||||
});
|
}
|
||||||
|
);
|
||||||
return data;
|
return data;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
<span class="knowledge-explorer-topic-link">{{topic.title}}</span>
|
|
|
@ -24,26 +24,7 @@
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{{#each topics as |topic|}}
|
{{#each topics as |topic|}}
|
||||||
<tr>
|
{{raw "knowledge-explorer-topic-list-item" topic=topic}}
|
||||||
<td class="main-link">
|
|
||||||
<span class="link-top-line">
|
|
||||||
{{topic-status topic=topic}}
|
|
||||||
{{knowledge-explorer-topic-link
|
|
||||||
topic=topic
|
|
||||||
selectTopic=selectTopic
|
|
||||||
}}
|
|
||||||
</span>
|
|
||||||
<span class="link-bottom-line">
|
|
||||||
{{category-link topic.category}}
|
|
||||||
{{#each topic.tags as |tag|}}
|
|
||||||
<span class="discourse-tag">{{tag}}</span>
|
|
||||||
{{/each}}
|
|
||||||
</span>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
{{format-date topic.bumped_at format="tiny" noTitle="true"}}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
<a data-topic-id="{{topic.id}}" class="knowledge-explorer-topic-link">{{{topic.fancyTitle}}}</a>
|
|
@ -0,0 +1,15 @@
|
||||||
|
<tr>
|
||||||
|
<td class="main-link">
|
||||||
|
<span class="link-top-line">
|
||||||
|
{{~raw "topic-status" topic=topic}}
|
||||||
|
{{~raw "knowledge-explorer-topic-link" topic=topic}}
|
||||||
|
</span>
|
||||||
|
<span class="link-bottom-line">
|
||||||
|
{{category-link topic.category}}
|
||||||
|
{{discourse-tags topic mode="list"}}
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{format-date topic.bumped_at format="tiny" noTitle="true"}}
|
||||||
|
</td>
|
||||||
|
</tr>
|
|
@ -132,13 +132,14 @@
|
||||||
max-width: 30vw;
|
max-width: 30vw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.discourse-tags {
|
||||||
|
font-weight: normal;
|
||||||
|
font-size: $font-down-1;
|
||||||
|
}
|
||||||
.knowledge-explorer-topic-link {
|
.knowledge-explorer-topic-link {
|
||||||
color: $tertiary;
|
color: $tertiary;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
.discourse-tag {
|
|
||||||
padding-right: 5px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
.knowledge-explorer-topic {
|
.knowledge-explorer-topic {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
Loading…
Reference in New Issue