Created
October 8, 2015 14:37
-
-
Save jbender/7b874fa9c20199dc2b75 to your computer and use it in GitHub Desktop.
ProMotion + RMQ custom styling
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FollowupPromptCell < PM::TableViewCell | |
def rmq_build | |
content.append!(UILabel, :followup_prompt_cell_label) | |
apply_style :followup_prompt_cell | |
end | |
def content | |
find(self.contentView) | |
end | |
def title=(value) | |
@title_view ||= begin | |
content.append! UILabel, :followup_prompt_cell_title | |
end | |
@title_view.text = value | |
@title_view | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module FollowupPromptCellStylesheet | |
def followup_prompt_cell(st) | |
st.frame = { | |
left: 10, | |
from_right: 10, | |
below_previous: 10, | |
top: 10, | |
height: 250 | |
} | |
st.background_color = color.white | |
end | |
def followup_prompt_cell_label(st) | |
st.frame = { top: 16, left: 16, from_right: 16, height: 20 } | |
st.font = font.small | |
st.color = color.contactually_grey | |
st.text = 'FOLLOW-UP' | |
end | |
def followup_prompt_cell_title(st) | |
st.frame = { | |
top: 20, | |
centered: :horizontal, | |
left: 16, | |
from_right: 16, | |
height: 40 | |
} | |
st.font = font.small | |
st.color = color.contactually_grey | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PromptsScreen < PM::TableScreen | |
title 'Prompts' | |
stylesheet PromptsScreenStylesheet | |
def on_load | |
@prompts = [] | |
async_load | |
end | |
def table_data | |
[{ | |
cells: @prompts.map { |prompt| followup_prompt_cell(prompt) } | |
}] | |
end | |
def followup_prompt_cell(prompt) | |
{ | |
cell_class: FollowupPromptCell, | |
properties: { | |
title: prompt[:title], | |
contact: prompt[:contact] | |
} | |
} | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PromptsScreenStylesheet < ApplicationStylesheet | |
include FollowupPromptCellStylesheet | |
def root_view(st) | |
st.background_color = nil | |
st.separator_style = UITableViewCellSeparatorStyleNone | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment