Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ nbproject
.sass-cache
.idea
.dat*.*
Gemfile.lock
Gemfile.lock
.ruby-version
7 changes: 7 additions & 0 deletions app/controllers/main_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ def viewDidLoad
end
end

# Sheet with no message
acs.append(UIButton, :alert_controller_five).on(:tap) do
rmq.app.alert(message: nil, style: :sheet, actions: :yes_no_cancel ) do |action_type|
puts "you clicked #{action_type}"
end
end

##############################
# Field examples
##############################
Expand Down
5 changes: 5 additions & 0 deletions app/stylesheets/main_stylesheet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ def alert_controller_four st
st.text = "Title and :sheet Style"
end

def alert_controller_five st
basic_button(st)
st.text = ":sheet Style with no message"
end

def alert_controller_fields_one st
basic_button(st)
st.text = "Fields :input Style"
Expand Down
8 changes: 7 additions & 1 deletion lib/project/red_alert.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@ def alert(opts={}, &block)
# ------------------------------------
opts = {message: opts} if opts.is_a? String
opts = {style: :alert, animated: true, show_now: true}.merge(opts)
opts[:message] = opts[:message] ? opts[:message].to_s : NSLocalizedString("Alert!", nil)

opts[:message] = if opts.has_key?(:message)
opts[:message].nil? ? nil : opts[:message].to_s
else
NSLocalizedString("Alert!", nil)
end

opts[:style] = VALID_STYLES.include?(opts[:style]) ? opts[:style] : :alert
opts[:fields] = opts[:style] == :custom && opts[:fields] ? opts[:fields] : {text: {placeholder: ''}}
api = rmq.device.ios_at_least?(8) ? :modern : :deprecated
Expand Down
4 changes: 4 additions & 0 deletions spec/red_alert_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@
@provider.alert_controller.message.should == "hello"
end

it "allows an empty message" do
@provider = rmq.app.alert(message: nil, show_now: false, animated: false)
@provider.alert_controller.message.should == nil
end
end

describe "UIActionSheet Hosted" do
Expand Down