Prechádzať zdrojové kódy

Show friendly names on dashboards

Andrew Kane 9 rokov pred
rodič
commit
361c54d50a

+ 4 - 0
app/models/blazer/query.rb

@@ -9,5 +9,9 @@ module Blazer
     def to_param
       [id, name.gsub("'", "").parameterize].join("-")
     end
+
+    def friendly_name
+      name.gsub(/\[.+\]/, "").strip
+    end
   end
 end

+ 1 - 1
app/views/blazer/dashboards/show.html.erb

@@ -130,7 +130,7 @@
 
 <% @queries.each_with_index do |query, i| %>
   <div style="margin-top: 40px;">
-    <h4 style="text-align: center;"><%= link_to query.name, query_path(query, variable_params), style: "color: inherit;" %></h4>
+    <h4 style="text-align: center;"><%= link_to query.friendly_name, query_path(query, variable_params), style: "color: inherit;" %></h4>
     <div id="chart-<%= i %>" style="height: 300px; text-align: center; line-height: 300px;">Loading...</div>
   </div>
   <script>