# Zuora Connect UI ## Installation Add this line to your application's Gemfile: ```ruby gem 'zuora_connect_ui' # Peek gem 'peek' gem 'peek-git' gem 'peek-pg' gem 'peek-performance_bar' gem 'peek-redis' gem 'peek-resque' ``` And then execute: ```shell $ bundle ``` Or install it yourself as: ```shell $ gem install zuora_connect_ui ``` ## Usage ### SCSS Imports Add to `app/assets/stylesheets/application.scss` ```scss //************ Peek ************ @import "peek"; @import "peek/views/performance_bar"; @import "peek/vendor/tipsy"; @import "zuora_connect_ui"; ``` Any style you create for your app should be imported below this ### Javascript Imports Add to `app/assets/javascripts/application.js` ```javascript //************** Peek **************** //= require peek //= require peek/views/performance_bar // //= require zuora_connect_ui ``` Any scripts you create for your app should be imported below this ### Peek Add the peek initializer in `config/initializers/peek.rb`: ```ruby # List of Peek Views shown in the container require 'peek' Peek.into Peek::Views::Git if Rails.env.development? Peek.into Peek::Views::PerformanceBar Peek.into Peek::Views::PG Peek.into Peek::Views::Redis Peek.into Peek::Views::Resque Peek.into Peek::Views::Connect Peek::Railtie.configure do config.peek.adapter = :redis end ``` and the peek route in `config/routes.rb` under the `app_admin` constraint ```ruby constraints app_admin do ... mount Peek::Railtie => '/peek' end ``` ## Layout ### Admin Button Partial: `partials/admin_menu` ```erb ``` Additional links can be added by putting `
  • ` tags in the block If you added Peek, you can enable it by passing `peek_bar: true` to the partial ### Row Actions Dropdown Menu Partial: `partials/row_actions' ```erb <%= render 'shared/row_actions' do %>
  • <%= link_to 'Show', page, remote: true, data: { toggle: 'modal', target: '#z_hub_modal' } %>
  • <%= link_to 'Edit', edit_page_path(page), remote: true, data: { toggle: 'modal', target: '#z_hub_modal' } %>
  • <%= link_to 'Delete', page, :remote => true, method: :delete, data: { confirm: 'Are you sure?' } %>
  • <% end %> ``` ## Components Component's labels must come directly after their input, and have `for` html attribute corresponding to their input. ### Textbox and Text Area Textbox ```erb <%= f.text_field :name, class: 'zuo-textbox' %> <%= f.label :name, class: zuo_floating_label_class(@page.name) %> ``` Text Area ```erb <%= f.text_area :description, class: 'zuo-textbox' %> <%= f.label :description, class: zuo_floating_label_class(@page.description) %> ``` Label must come directly after input, and have `for` html attribute corresponding to input. `zuo_floating_label_class` sets the initial floating state of the label. If the value passed in is not empty, then the label will start with the `floating` class. ### Buttons ```erb <%= link_to "Cancel", "#", class: "zuo-btn secondary", data: {dismiss: "modal"} %> <%= f.submit f.object.new_record? ? "Create" : "Update", class: "zuo-btn primary" %> ``` `
    `, `