Skip to content
This repository has been 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
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

walker
Copy link
Contributor

@walker walker commented Jan 24, 2013

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

@Gipetto
Copy link
Contributor

Gipetto commented Jan 24, 2013

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
Copy link
Contributor Author

walker commented Jan 24, 2013

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
Copy link
Contributor Author

walker commented Jan 24, 2013

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
Contributor

@walker
Copy link
Contributor Author

walker commented Feb 22, 2013

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

@caseysoftware
Copy link
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