Skip to content
This repository was archived by the owner on Mar 4, 2021. It is now read-only.

Hide call and online/offline when no application_sid present#231

Open
walker wants to merge 4 commits into
twilio:developfrom
walker:call_with_no_applicationsid
Open

Hide call and online/offline when no application_sid present#231
walker wants to merge 4 commits into
twilio:developfrom
walker:call_with_no_applicationsid

Conversation

@walker

@walker walker commented Jan 24, 2013

Copy link
Copy Markdown
Contributor

I think this handles #230 fairly well from an interface perspective.

@Gipetto

Gipetto commented Jan 24, 2013

Copy link
Copy Markdown
Contributor

Instead of doing the nested if statements in the template can you instead define a single var of "can_enable_client" (or something better, yes, definitely figure out a better name than that ;) ) in the controller and simply reference that variable in the template? Alternately you could define a new helper function in the twilio_helpers that would do this logic and returns a boolean. It'd be a lot cleaner and reusable.

@walker

walker commented Jan 24, 2013

Copy link
Copy Markdown
Contributor Author

I like the helper option over the controller var option. I'll try that one. Is there a particular global variable that I should be utilizing? I'm not entirely certain what $this is an instance of in the view's case. Perhaps the view class? ...I'm not much of a CodeIgniter user.

@walker

walker commented Jan 24, 2013

Copy link
Copy Markdown
Contributor Author

Sooo....I found a couple things:

  1. $ci can do: $ci->vbx_settings->get('application_sid', $ci->tenant->id);
  2. We were checking for isset($callerid_numbers) && $callerid_numbers >||== 1) often in the view.
  3. Apparently there was no easy way to get $callerid_numbers into the helper function without passing it as an argument.

What I ended up doing was creating two helper functions:

  1. count_callerid_numbers()
  2. web_calling_enabled()

So now, we just do, for case 1:

if(web_calling_enabled()) {

And for case two:

if(count_callerid_numbers()==1) {

or

if(count_callerid_numbers()>1) {

I'll add this stuff here in a moment.

@caseysoftware

Copy link
Copy Markdown
Contributor

@walker

walker commented Feb 22, 2013

Copy link
Copy Markdown
Contributor Author

What do you see as the path going forward on this & #232?

@caseysoftware

Copy link
Copy Markdown
Contributor

If we can create/retrieve an AppSid automatically, we can completely skip this issue. My preference is to move towards properly auto-configuring the system as opposed to disabling functionality.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants